about summary refs log tree commit diff
path: root/nixpkgs/nixos/modules/tasks/filesystems/zfs.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/nixos/modules/tasks/filesystems/zfs.nix')
-rw-r--r--nixpkgs/nixos/modules/tasks/filesystems/zfs.nix57
1 files changed, 32 insertions, 25 deletions
diff --git a/nixpkgs/nixos/modules/tasks/filesystems/zfs.nix b/nixpkgs/nixos/modules/tasks/filesystems/zfs.nix
index d11424c11c81..2c749d45d7a1 100644
--- a/nixpkgs/nixos/modules/tasks/filesystems/zfs.nix
+++ b/nixpkgs/nixos/modules/tasks/filesystems/zfs.nix
@@ -222,14 +222,14 @@ in
         type = types.package;
         default = pkgs.zfs;
         defaultText = literalExpression "pkgs.zfs";
-        description = lib.mdDoc "Configured ZFS userland tools package, use `pkgs.zfs_unstable` if you want to track the latest staging ZFS branch.";
+        description = "Configured ZFS userland tools package, use `pkgs.zfs_unstable` if you want to track the latest staging ZFS branch.";
       };
 
       modulePackage = mkOption {
         internal = true; # It is supposed to be selected automatically, but can be overridden by expert users.
         default = selectModulePackage cfgZfs.package;
         type = types.package;
-        description = lib.mdDoc "Configured ZFS kernel module package.";
+        description = "Configured ZFS kernel module package.";
       };
 
       enabled = mkOption {
@@ -237,13 +237,13 @@ in
         type = types.bool;
         default = inInitrd || inSystem;
         defaultText = literalMD "`true` if ZFS filesystem support is enabled";
-        description = lib.mdDoc "True if ZFS filesystem support is enabled";
+        description = "True if ZFS filesystem support is enabled";
       };
 
       allowHibernation = mkOption {
         type = types.bool;
         default = false;
-        description = lib.mdDoc ''
+        description = ''
           Allow hibernation support, this may be a unsafe option depending on your
           setup. Make sure to NOT use Swap on ZFS.
         '';
@@ -253,7 +253,7 @@ in
         type = types.listOf types.str;
         default = [];
         example = [ "tank" "data" ];
-        description = lib.mdDoc ''
+        description = ''
           Name or GUID of extra ZFS pools that you wish to import during boot.
 
           Usually this is not necessary. Instead, you should set the mountpoint property
@@ -271,7 +271,7 @@ in
       devNodes = mkOption {
         type = types.path;
         default = "/dev/disk/by-id";
-        description = lib.mdDoc ''
+        description = ''
           Name of directory from which to import ZFS devices.
 
           This should be a path under /dev containing stable names for all devices needed, as
@@ -282,7 +282,7 @@ in
       forceImportRoot = mkOption {
         type = types.bool;
         default = true;
-        description = lib.mdDoc ''
+        description = ''
           Forcibly import the ZFS root pool(s) during early boot.
 
           This is enabled by default for backwards compatibility purposes, but it is highly
@@ -300,7 +300,7 @@ in
       forceImportAll = mkOption {
         type = types.bool;
         default = false;
-        description = lib.mdDoc ''
+        description = ''
           Forcibly import all ZFS pool(s).
 
           If you set this option to `false` and NixOS subsequently fails to
@@ -314,7 +314,7 @@ in
         type = types.either types.bool (types.listOf types.str);
         default = true;
         example = [ "tank" "data" ];
-        description = lib.mdDoc ''
+        description = ''
           If true on import encryption keys or passwords for all encrypted datasets
           are requested. To only decrypt selected datasets supply a list of dataset
           names instead. For root pools the encryption key can be supplied via both
@@ -325,7 +325,7 @@ in
       passwordTimeout = mkOption {
         type = types.int;
         default = 0;
-        description = lib.mdDoc ''
+        description = ''
           Timeout in seconds to wait for password entry for decrypt at boot.
 
           Defaults to 0, which waits forever.
@@ -349,7 +349,7 @@ in
       enable = mkOption {
         default = false;
         type = types.bool;
-        description = lib.mdDoc ''
+        description = ''
           Enable the (OpenSolaris-compatible) ZFS auto-snapshotting service.
           Note that you must set the `com.sun:auto-snapshot`
           property to `true` on all datasets which you wish
@@ -365,7 +365,7 @@ in
         default = "-k -p";
         example = "-k -p --utc";
         type = types.str;
-        description = lib.mdDoc ''
+        description = ''
           Flags to pass to the zfs-auto-snapshot command.
 
           Run `zfs-auto-snapshot` (without any arguments) to
@@ -383,7 +383,7 @@ in
       frequent = mkOption {
         default = 4;
         type = types.int;
-        description = lib.mdDoc ''
+        description = ''
           Number of frequent (15-minute) auto-snapshots that you wish to keep.
         '';
       };
@@ -391,7 +391,7 @@ in
       hourly = mkOption {
         default = 24;
         type = types.int;
-        description = lib.mdDoc ''
+        description = ''
           Number of hourly auto-snapshots that you wish to keep.
         '';
       };
@@ -399,7 +399,7 @@ in
       daily = mkOption {
         default = 7;
         type = types.int;
-        description = lib.mdDoc ''
+        description = ''
           Number of daily auto-snapshots that you wish to keep.
         '';
       };
@@ -407,7 +407,7 @@ in
       weekly = mkOption {
         default = 4;
         type = types.int;
-        description = lib.mdDoc ''
+        description = ''
           Number of weekly auto-snapshots that you wish to keep.
         '';
       };
@@ -415,7 +415,7 @@ in
       monthly = mkOption {
         default = 12;
         type = types.int;
-        description = lib.mdDoc ''
+        description = ''
           Number of monthly auto-snapshots that you wish to keep.
         '';
       };
@@ -423,7 +423,7 @@ in
 
     services.zfs.trim = {
       enable = mkOption {
-        description = lib.mdDoc "Whether to enable periodic TRIM on all ZFS pools.";
+        description = "Whether to enable periodic TRIM on all ZFS pools.";
         default = true;
         example = false;
         type = types.bool;
@@ -433,7 +433,7 @@ in
         default = "weekly";
         type = types.str;
         example = "daily";
-        description = lib.mdDoc ''
+        description = ''
           How often we run trim. For most desktop and server systems
           a sufficient trimming frequency is once a week.
 
@@ -444,13 +444,13 @@ in
     };
 
     services.zfs.autoScrub = {
-      enable = mkEnableOption (lib.mdDoc "periodic scrubbing of ZFS pools");
+      enable = mkEnableOption "periodic scrubbing of ZFS pools";
 
       interval = mkOption {
         default = "Sun, 02:00";
         type = types.str;
         example = "daily";
-        description = lib.mdDoc ''
+        description = ''
           Systemd calendar expression when to scrub ZFS pools. See
           {manpage}`systemd.time(7)`.
         '';
@@ -460,7 +460,7 @@ in
         default = [];
         type = types.listOf types.str;
         example = [ "tank" ];
-        description = lib.mdDoc ''
+        description = ''
           List of ZFS pools to periodically scrub. If empty, all pools
           will be scrubbed.
         '';
@@ -471,7 +471,7 @@ in
       type = types.either (types.enum [ "disabled" "all" ]) (types.listOf types.str);
       default = "disabled";
       example = [ "tank" "dozer" ];
-      description = lib.mdDoc ''
+      description = ''
         After importing, expand each device in the specified pools.
 
         Set the value to the plain string "all" to expand all pools on boot:
@@ -491,7 +491,7 @@ in
         defaultText = literalExpression ''
           config.services.mail.sendmailSetuidWrapper != null
         '';
-        description = mdDoc ''
+        description = ''
           Whether to enable ZED's ability to send emails.
         '';
       };
@@ -513,7 +513,7 @@ in
             ZED_SCRUB_AFTER_RESILVER = false;
           }
         '';
-        description = lib.mdDoc ''
+        description = ''
           ZFS Event Daemon /etc/zfs/zed.d/zed.rc content
 
           See
@@ -576,6 +576,8 @@ in
             copy_bin_and_libs ${cfgZfs.package}/sbin/zfs
             copy_bin_and_libs ${cfgZfs.package}/sbin/zdb
             copy_bin_and_libs ${cfgZfs.package}/sbin/zpool
+            copy_bin_and_libs ${cfgZfs.package}/lib/udev/vdev_id
+            copy_bin_and_libs ${cfgZfs.package}/lib/udev/zvol_id
           '';
         extraUtilsCommandsTest =
           mkIf (!config.boot.initrd.systemd.enable) ''
@@ -632,7 +634,12 @@ in
             zfs = "${cfgZfs.package}/sbin/zfs";
             awk = "${pkgs.gawk}/bin/awk";
           };
+          storePaths = [
+            "${cfgZfs.package}/lib/udev/vdev_id"
+            "${cfgZfs.package}/lib/udev/zvol_id"
+          ];
         };
+        services.udev.packages = [cfgZfs.package]; # to hook zvol naming, in stage 1
       };
 
       systemd.shutdownRamfs.contents."/etc/systemd/system-shutdown/zpool".source = pkgs.writeShellScript "zpool-sync-shutdown" ''