3 { config, lib, pkgs, ... }:
8 settingsFormat = pkgs.formats.ini {
9 listToValue = concatMapStringsSep "," (generators.mkValueStringDefault {});
11 configFiles = mapAttrs (name: value: (settingsFormat.generate name value)) (mapAttrs' (name: value: nameValuePair name value ) config.services.udisks2.settings);
22 enable = mkEnableOption (lib.mdDoc "udisks2, a DBus service that allows applications to query and manipulate storage devices.");
24 settings = mkOption rec {
25 type = types.attrsOf settingsFormat.type;
26 apply = recursiveUpdate default;
31 modules_load_preference = "ondemand";
38 example = literalExpression ''
40 "WDC-WD10EZEX-60M2NA0-WD-WCC3F3SJ0698.conf" = {
47 description = lib.mdDoc ''
48 Options passed to udisksd.
49 See [here](http://manpages.ubuntu.com/manpages/latest/en/man5/udisks2.conf.5.html) and
50 drive configuration in [here](http://manpages.ubuntu.com/manpages/latest/en/man8/udisks.8.html) for supported options.
61 config = mkIf config.services.udisks2.enable {
63 environment.systemPackages = [ pkgs.udisks2 ];
65 environment.etc = mapAttrs' (name: value: nameValuePair "udisks2/${name}" { source = value; } ) configFiles;
67 security.polkit.enable = true;
69 services.dbus.packages = [ pkgs.udisks2 ];
71 systemd.tmpfiles.rules = [ "d /var/lib/udisks2 0755 root root -" ];
73 services.udev.packages = [ pkgs.udisks2 ];
75 systemd.packages = [ pkgs.udisks2 ];