nixos/stage-1-systemd: fix initrd-fstab generation for bind mounts

This commit is contained in:
Nick Cao 2022-08-04 10:00:35 +08:00
parent b5a9dea9c8
commit ce39bee9dd
No known key found for this signature in database
GPG key ID: 068A56CEF48FA2C1

View file

@ -103,7 +103,8 @@ let
fstab = pkgs.writeText "initrd-fstab" (lib.concatMapStringsSep "\n" fstab = pkgs.writeText "initrd-fstab" (lib.concatMapStringsSep "\n"
({ fsType, mountPoint, device, options, autoFormat, autoResize, ... }@fs: let ({ fsType, mountPoint, device, options, autoFormat, autoResize, ... }@fs: let
opts = options ++ optional autoFormat "x-systemd.makefs" ++ optional autoResize "x-systemd.growfs"; opts = options ++ optional autoFormat "x-systemd.makefs" ++ optional autoResize "x-systemd.growfs";
in "${device} /sysroot${mountPoint} ${fsType} ${lib.concatStringsSep "," opts}") fileSystems); finalDevice = if (lib.elem "bind" options) then "/sysroot${device}" else device;
in "${finalDevice} /sysroot${mountPoint} ${fsType} ${lib.concatStringsSep "," opts}") fileSystems);
needMakefs = lib.any (fs: fs.autoFormat) fileSystems; needMakefs = lib.any (fs: fs.autoFormat) fileSystems;
needGrowfs = lib.any (fs: fs.autoResize) fileSystems; needGrowfs = lib.any (fs: fs.autoResize) fileSystems;