summary refs log tree commit diff
path: root/nixos/modules/tasks
diff options
context:
space:
mode:
authorDaniel Carosone <dan@geek.com.au>2023-06-16 10:40:09 +1000
committerDaniel Carosone <dan@geek.com.au>2023-06-16 10:40:09 +1000
commit2dcb1b3ed7defffd8cc418a94d33d32807f8fcf8 (patch)
tree185cab824785cdf31d2b5844c90eb8f89beec420 /nixos/modules/tasks
parent0eeebd64de89e4163f4d3cf34ffe925a5cf67a05 (diff)
downloadnixpkgs-2dcb1b3ed7defffd8cc418a94d33d32807f8fcf8.tar
nixpkgs-2dcb1b3ed7defffd8cc418a94d33d32807f8fcf8.tar.gz
nixpkgs-2dcb1b3ed7defffd8cc418a94d33d32807f8fcf8.tar.bz2
nixpkgs-2dcb1b3ed7defffd8cc418a94d33d32807f8fcf8.tar.lz
nixpkgs-2dcb1b3ed7defffd8cc418a94d33d32807f8fcf8.tar.xz
nixpkgs-2dcb1b3ed7defffd8cc418a94d33d32807f8fcf8.tar.zst
nixpkgs-2dcb1b3ed7defffd8cc418a94d33d32807f8fcf8.zip
nixos/zfs: assert that pool names are not empty
a zfs fileSystems entry with an absolute (e.g. device) path rather than
a zfs dataser is parsed as an empty pool name, causing a doomed-to-fail
import job to be created as a boot dependency. Catch this as an assertion
Diffstat (limited to 'nixos/modules/tasks')
-rw-r--r--nixos/modules/tasks/filesystems/zfs.nix9
1 files changed, 9 insertions, 0 deletions
diff --git a/nixos/modules/tasks/filesystems/zfs.nix b/nixos/modules/tasks/filesystems/zfs.nix
index 16dc0c44c18..c214e277db4 100644
--- a/nixos/modules/tasks/filesystems/zfs.nix
+++ b/nixos/modules/tasks/filesystems/zfs.nix
@@ -523,6 +523,15 @@ in
           assertion = cfgZfs.allowHibernation -> !cfgZfs.forceImportRoot && !cfgZfs.forceImportAll;
           message = "boot.zfs.allowHibernation while force importing is enabled will cause data corruption";
         }
+        {
+          assertion = !(elem "" allPools);
+          message = ''
+            Automatic pool detection found an empty pool name, which can't be used.
+            Hint: for `fileSystems` entries with `fsType = zfs`, the `device` attribute
+            should be a zfs dataset name, like `device = "pool/data/set"`.
+            This error can be triggered by using an absolute path, such as `"/dev/disks/..."`.
+          '';
+        }
       ];
 
       boot = {