Skip to content

Commit

Permalink
Merge pull request #220 from nix-community/zfs-deps
Browse files Browse the repository at this point in the history
nixos: Fix create-needed-for-boot-dirs dependencies for zfs
  • Loading branch information
talyz authored Sep 28, 2024
2 parents 8514fff + a8fb3f7 commit fff0d95
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -719,8 +719,14 @@ in
matchFileSystems = fs: attrValues (filterAttrs (_: v: v.mountPoint or null == fs) all);
in
concatMap matchFileSystems persistentStoragePaths;
devices =
map (d: "${(escapeSystemdPath d)}.device") (catAttrs "device" fileSystems);
deviceUnits = unique
(map
(fs:
if fs.fsType == "zfs" then
"zfs-import.target"
else
"${(escapeSystemdPath fs.device)}.device")
fileSystems);
createNeededForBootDirs = ''
${concatMapStrings mkMount fileSystems}
${concatMapStrings mkDir neededForBootDirs}
Expand All @@ -731,10 +737,11 @@ in
systemd.services = mkIf config.boot.initrd.systemd.enable {
create-needed-for-boot-dirs = {
wantedBy = [ "initrd-root-device.target" ];
wants = devices;
after = devices;
requires = deviceUnits;
after = deviceUnits;
before = [ "sysroot.mount" ];
serviceConfig.Type = "oneshot";
unitConfig.DefaultDependencies = false;
script = createNeededForBootDirs;
};
};
Expand Down

0 comments on commit fff0d95

Please sign in to comment.