diff options
Diffstat (limited to 'nixos/modules/system/boot/stage-1.nix')
-rw-r--r-- | nixos/modules/system/boot/stage-1.nix | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix index baeba1d6b31d..9be7ad4ae077 100644 --- a/nixos/modules/system/boot/stage-1.nix +++ b/nixos/modules/system/boot/stage-1.nix @@ -131,9 +131,16 @@ let # The initrd only has to mount / or any FS marked as necessary for # booting (such as the FS containing /nix/store, or an FS needed for # mounting /, like / on a loopback). - fileSystems = filter - (fs: fs.neededForBoot || elem fs.mountPoint [ "/" "/nix" "/nix/store" "/var" "/var/log" "/var/lib" "/etc" ]) - (attrValues config.fileSystems); + # + # We need to guarantee that / is the first filesystem in the list so + # that if and when lustrateRoot is invoked, nothing else is mounted + fileSystems = let + filterNeeded = filter + (fs: fs.mountPoint != "/" && (fs.neededForBoot || elem fs.mountPoint [ "/nix" "/nix/store" "/var" "/var/log" "/var/lib" "/etc" ])); + filterRoot = filter + (fs: fs.mountPoint == "/"); + allFileSystems = attrValues config.fileSystems; + in (filterRoot allFileSystems) ++ (filterNeeded allFileSystems); udevRules = pkgs.stdenv.mkDerivation { |