nixos/zfs: fix not auto-importing pools without any fileSystems (#365058)

This commit is contained in:
Adam C. Stephens 2024-12-14 10:22:24 -05:00 committed by GitHub
commit c937a5c697
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -129,7 +129,8 @@ let
"systemd-ask-password-console.service"
] ++ lib.optional (config.boot.initrd.clevis.useTang) "network-online.target";
requiredBy = let
noauto = lib.all (fs: lib.elem "noauto" fs.options) (getPoolFilesystems pool);
poolFilesystems = getPoolFilesystems pool;
noauto = poolFilesystems != [ ] && lib.all (fs: lib.elem "noauto" fs.options) poolFilesystems;
in getPoolMounts prefix pool ++ lib.optional (!noauto) "zfs-import.target";
before = getPoolMounts prefix pool ++ [ "shutdown.target" "zfs-import.target" ];
conflicts = [ "shutdown.target" ];