2013-04-04 08:50:16 +01:00
|
|
|
# Udisks daemon.
|
|
|
|
|
2014-04-14 15:26:48 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
2013-04-04 08:50:16 +01:00
|
|
|
|
2014-04-14 15:26:48 +01:00
|
|
|
with lib;
|
2013-04-04 08:50:16 +01:00
|
|
|
|
2022-04-03 07:22:08 +01:00
|
|
|
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
|
|
|
|
|
2013-04-04 08:50:16 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
services.udisks2 = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
type = types.bool;
|
2014-04-19 13:41:21 +01:00
|
|
|
default = true;
|
2013-04-04 08:50:16 +01:00
|
|
|
description = ''
|
|
|
|
Whether to enable Udisks, a DBus service that allows
|
|
|
|
applications to query and manipulate storage devices.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2022-04-03 07:22:08 +01:00
|
|
|
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 <link xlink:href="http://manpages.ubuntu.com/manpages/latest/en/man5/udisks2.conf.5.html">here</link> and
|
|
|
|
drive configuration in <link xlink:href="http://manpages.ubuntu.com/manpages/latest/en/man8/udisks.8.html">here</link> for supported options.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2013-04-04 08:50:16 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = mkIf config.services.udisks2.enable {
|
|
|
|
|
|
|
|
environment.systemPackages = [ pkgs.udisks2 ];
|
|
|
|
|
2022-04-03 07:22:08 +01:00
|
|
|
environment.etc = mapAttrs' (name: value: nameValuePair "udisks2/${name}" { source = value; } ) configFiles;
|
|
|
|
|
2022-03-02 16:38:36 +00:00
|
|
|
security.polkit.enable = true;
|
|
|
|
|
2013-04-04 08:50:16 +01:00
|
|
|
services.dbus.packages = [ pkgs.udisks2 ];
|
|
|
|
|
2019-10-16 18:31:58 +01:00
|
|
|
systemd.tmpfiles.rules = [ "d /var/lib/udisks2 0755 root root -" ];
|
2013-04-04 08:50:16 +01:00
|
|
|
|
2015-12-14 23:38:07 +00:00
|
|
|
services.udev.packages = [ pkgs.udisks2 ];
|
2018-07-08 15:35:10 +01:00
|
|
|
|
|
|
|
systemd.packages = [ pkgs.udisks2 ];
|
2013-04-04 08:50:16 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|