diff options
author | Will Fancher <elvishjerricco@gmail.com> | 2023-04-20 03:03:21 -0400 |
---|---|---|
committer | Will Fancher <elvishjerricco@gmail.com> | 2023-07-23 14:12:53 -0400 |
commit | 0ddc9d0250da0a58a2a28b922f9db3b771b23ca7 (patch) | |
tree | 40b4e39c7cbf7487b16dd9d3933f65ba801e4721 /nixos/modules/tasks/filesystems | |
parent | ad274bf46a418c5db3e3e94ef9295f8824fc2729 (diff) | |
download | nixlib-0ddc9d0250da0a58a2a28b922f9db3b771b23ca7.tar nixlib-0ddc9d0250da0a58a2a28b922f9db3b771b23ca7.tar.gz nixlib-0ddc9d0250da0a58a2a28b922f9db3b771b23ca7.tar.bz2 nixlib-0ddc9d0250da0a58a2a28b922f9db3b771b23ca7.tar.lz nixlib-0ddc9d0250da0a58a2a28b922f9db3b771b23ca7.tar.xz nixlib-0ddc9d0250da0a58a2a28b922f9db3b771b23ca7.tar.zst nixlib-0ddc9d0250da0a58a2a28b922f9db3b771b23ca7.zip |
zfs: Relate import services to zfs-import.target instead of local-fs
Being wanted by and ordered before local-fs.target isn't strictly correct. And in systemd initrd, it's very incorrect because local-fs.target is for the initrd file system, not the real root file system.
Diffstat (limited to 'nixos/modules/tasks/filesystems')
-rw-r--r-- | nixos/modules/tasks/filesystems/zfs.nix | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/nixos/modules/tasks/filesystems/zfs.nix b/nixos/modules/tasks/filesystems/zfs.nix index 72b937f3732b..e148446540bd 100644 --- a/nixos/modules/tasks/filesystems/zfs.nix +++ b/nixos/modules/tasks/filesystems/zfs.nix @@ -119,8 +119,8 @@ let "systemd-modules-load.service" "systemd-ask-password-console.service" ]; - wantedBy = (getPoolMounts prefix pool) ++ [ "local-fs.target" ]; - before = (getPoolMounts prefix pool) ++ [ "local-fs.target" ]; + requiredBy = getPoolMounts prefix pool ++ [ "zfs-import.target" ]; + before = getPoolMounts prefix pool ++ [ "zfs-import.target" ]; unitConfig = { DefaultDependencies = "no"; }; @@ -628,6 +628,8 @@ in force = cfgZfs.forceImportRoot; prefix = "/sysroot"; }) rootPools); + targets.zfs-import.wantedBy = [ "zfs.target" ]; + targets.zfs.wantedBy = [ "initrd.target" ]; extraBin = { # zpool and zfs are already in thanks to fsPackages awk = "${pkgs.gawk}/bin/awk"; @@ -739,15 +741,7 @@ in map createSyncService allPools ++ map createZfsService [ "zfs-mount" "zfs-share" "zfs-zed" ]); - systemd.targets.zfs-import = - let - services = map (pool: "zfs-import-${pool}.service") dataPools; - in - { - requires = services; - after = services; - wantedBy = [ "zfs.target" ]; - }; + systemd.targets.zfs-import.wantedBy = [ "zfs.target" ]; systemd.targets.zfs.wantedBy = [ "multi-user.target" ]; }) |