diff options
author | Daniel Carosone <dan@geek.com.au> | 2023-06-16 10:40:09 +1000 |
---|---|---|
committer | Daniel Carosone <dan@geek.com.au> | 2023-06-16 10:40:09 +1000 |
commit | 2dcb1b3ed7defffd8cc418a94d33d32807f8fcf8 (patch) | |
tree | 185cab824785cdf31d2b5844c90eb8f89beec420 /nixos/modules/tasks | |
parent | 0eeebd64de89e4163f4d3cf34ffe925a5cf67a05 (diff) | |
download | nixpkgs-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.nix | 9 |
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 = { |