From 82f2b4785afc723786af248c5e8b7c5ba9d48fca Mon Sep 17 00:00:00 2001 From: talyz Date: Sun, 29 Sep 2024 14:04:24 +0200 Subject: [PATCH] nixos: Fix create-needed-for-boot-dirs label-adressed dependencies 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. --- nixos.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nixos.nix b/nixos.nix index b4941be..f49cd1a 100644 --- a/nixos.nix +++ b/nixos.nix @@ -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 @@ -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}