diff --git a/nixos/modules/services/hardware/udisks2.nix b/nixos/modules/services/hardware/udisks2.nix
index 6be23f39754e..ea552ce867e8 100644
--- a/nixos/modules/services/hardware/udisks2.nix
+++ b/nixos/modules/services/hardware/udisks2.nix
@@ -4,6 +4,13 @@
with lib;
+let
+ settingsFormat = pkgs.formats.ini {
+ listToValue = concatMapStringsSep "," (generators.mkValueStringDefault {});
+ };
+ configFiles = mapAttrs (name: value: (settingsFormat.generate name value)) (mapAttrs' (name: value: nameValuePair name value ) config.services.udisks2.settings);
+in
+
{
###### interface
@@ -21,6 +28,36 @@ with lib;
'';
};
+ settings = mkOption rec {
+ type = types.attrsOf settingsFormat.type;
+ apply = recursiveUpdate default;
+ default = {
+ "udisks2.conf" = {
+ udisks2 = {
+ modules = [ "*" ];
+ modules_load_preference = "ondemand";
+ };
+ defaults = {
+ encryption = "luks2";
+ };
+ };
+ };
+ example = literalExpression ''
+ {
+ "WDC-WD10EZEX-60M2NA0-WD-WCC3F3SJ0698.conf" = {
+ ATA = {
+ StandbyTimeout = 50;
+ };
+ };
+ };
+ '';
+ description = ''
+ Options passed to udisksd.
+ See here and
+ drive configuration in here for supported options.
+ '';
+ };
+
};
};
@@ -32,6 +69,8 @@ with lib;
environment.systemPackages = [ pkgs.udisks2 ];
+ environment.etc = mapAttrs' (name: value: nameValuePair "udisks2/${name}" { source = value; } ) configFiles;
+
security.polkit.enable = true;
services.dbus.packages = [ pkgs.udisks2 ];