Skip to content

Commit

Permalink
nixos: Fix create-needed-for-boot-dirs label-adressed dependencies
Browse files Browse the repository at this point in the history
When a file system entry is specified by its label, not by its device,
we have to generate the device path from the label. While this was
already done in the script, it wasn't for the systemd unit
dependencies.
  • Loading branch information
talyz committed Sep 29, 2024
1 parent a8fb3f7 commit 82f2b47
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -695,10 +695,11 @@ in
let
neededForBootFs = catAttrs "mountPoint" (filter fsNeededForBoot (attrValues config.fileSystems));
neededForBootDirs = filter (dir: elem dir.dirPath neededForBootFs) directories;
getDevice = fs: if fs.device != null then fs.device else "/dev/disk/by-label/${fs.label}";
mkMount = fs:
let
mountPoint = concatPaths [ "/persist-tmp-mnt" fs.mountPoint ];
device = if fs.device != null then fs.device else "/dev/disk/by-label/${fs.label}";
device = getDevice fs;
options = filter (o: (builtins.match "(x-.*\.mount)" o) == null) fs.options;
optionsFlag = optionalString (options != [ ]) ("-o " + escapeShellArg (concatStringsSep "," options));
in
Expand All @@ -725,7 +726,7 @@ in
if fs.fsType == "zfs" then
"zfs-import.target"
else
"${(escapeSystemdPath fs.device)}.device")
"${(escapeSystemdPath (getDevice fs))}.device")
fileSystems);
createNeededForBootDirs = ''
${concatMapStrings mkMount fileSystems}
Expand Down

0 comments on commit 82f2b47

Please sign in to comment.