about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorBernardo Meurer <bernardo@meurer.org>2022-08-05 14:25:11 -0700
committerGitHub <noreply@github.com>2022-08-05 14:25:11 -0700
commit5b3a9a815d4acb6c309360cce1ff9cd03e8b583f (patch)
tree37482f1b4d65511851e8f4815a967eee57568fcc /nixos
parent1139611da2ee1776b0eeecc591ea0d77b7fb1da7 (diff)
parentce39bee9dd61d6ea5c336450915d9601f3a26b9b (diff)
Merge pull request #185089 from NickCao/bind
nixos/stage-1-systemd: fix initrd-fstab generation for bind mounts
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/system/boot/systemd/initrd.nix3
1 files changed, 2 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/systemd/initrd.nix b/nixos/modules/system/boot/systemd/initrd.nix
index 4c12088b41a69..0351453a6587b 100644
--- a/nixos/modules/system/boot/systemd/initrd.nix
+++ b/nixos/modules/system/boot/systemd/initrd.nix
@@ -103,7 +103,8 @@ let
   fstab = pkgs.writeText "initrd-fstab" (lib.concatMapStringsSep "\n"
     ({ fsType, mountPoint, device, options, autoFormat, autoResize, ... }@fs: let
         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;
   needGrowfs = lib.any (fs: fs.autoResize) fileSystems;