diff --git a/nixos/modules/services/hardware/udisks2.nix b/nixos/modules/services/hardware/udisks2.nix
index 6be23f39754..ea552ce867e 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 ];
diff --git a/pkgs/os-specific/linux/udisks/2-default.nix b/pkgs/os-specific/linux/udisks/2-default.nix
index 427e19ac921..5aff6e96970 100644
--- a/pkgs/os-specific/linux/udisks/2-default.nix
+++ b/pkgs/os-specific/linux/udisks/2-default.nix
@@ -1,8 +1,9 @@
-{ lib, stdenv, fetchFromGitHub, substituteAll, libtool, pkg-config, gettext, gnused
+{ lib, stdenv, fetchFromGitHub, substituteAll, pkg-config, gnused, autoreconfHook
, gtk-doc, acl, systemd, glib, libatasmart, polkit, coreutils, bash, which
, expat, libxslt, docbook_xsl, util-linux, mdadm, libgudev, libblockdev, parted
-, gobject-introspection, docbook_xml_dtd_412, docbook_xml_dtd_43, autoconf, automake
+, gobject-introspection, docbook_xml_dtd_412, docbook_xml_dtd_43
, xfsprogs, f2fs-tools, dosfstools, e2fsprogs, btrfs-progs, exfat, nilfs-utils, ntfs3g
+, nixosTests
}:
stdenv.mkDerivation rec {
@@ -41,8 +42,11 @@ stdenv.mkDerivation rec {
})
];
+ strictDeps = true;
+ # pkg-config had to be in both to find gtk-doc and gobject-introspection
+ depsBuildBuild = [ pkg-config ];
nativeBuildInputs = [
- autoconf automake pkg-config libtool gettext which gobject-introspection
+ autoreconfHook which gobject-introspection pkg-config
gtk-doc libxslt docbook_xml_dtd_412 docbook_xml_dtd_43 docbook_xsl
];
@@ -60,6 +64,7 @@ stdenv.mkDerivation rec {
configureFlags = [
(lib.enableFeature (stdenv.buildPlatform == stdenv.hostPlatform) "gtk-doc")
+ "--sysconfdir=/etc"
"--localstatedir=/var"
"--with-systemdsystemunitdir=$(out)/etc/systemd/system"
"--with-udevdir=$(out)/lib/udev"
@@ -71,10 +76,16 @@ stdenv.mkDerivation rec {
"INTROSPECTION_TYPELIBDIR=$(out)/lib/girepository-1.0"
];
+ installFlags = [
+ "sysconfdir=${placeholder "out"}/etc"
+ ];
+
enableParallelBuilding = true;
doCheck = true;
+ passthru.tests.vm = nixosTests.udisks2;
+
meta = with lib; {
description = "A daemon, tools and libraries to access and manipulate disks, storage devices and technologies";
homepage = "https://www.freedesktop.org/wiki/Software/udisks/";