diff options
author | obadz <obadz-git@obadz.com> | 2016-08-27 23:54:54 +0100 |
---|---|---|
committer | obadz <obadz-git@obadz.com> | 2016-08-27 23:54:54 +0100 |
commit | 3de6e5be50124834f9d0adfc299295e9e6e30c08 (patch) | |
tree | 31c4c7003ca554e75fa7ead8242f00922a92b25f /nixos/modules/system | |
parent | 132571454c8162cdefe9e94613137d6a13b950b7 (diff) | |
parent | df27c35e9a0515146eb7db07e11af59e520214a6 (diff) | |
download | nixlib-3de6e5be50124834f9d0adfc299295e9e6e30c08.tar nixlib-3de6e5be50124834f9d0adfc299295e9e6e30c08.tar.gz nixlib-3de6e5be50124834f9d0adfc299295e9e6e30c08.tar.bz2 nixlib-3de6e5be50124834f9d0adfc299295e9e6e30c08.tar.lz nixlib-3de6e5be50124834f9d0adfc299295e9e6e30c08.tar.xz nixlib-3de6e5be50124834f9d0adfc299295e9e6e30c08.tar.zst nixlib-3de6e5be50124834f9d0adfc299295e9e6e30c08.zip |
Merge branch 'master' into staging
Conflicts: pkgs/applications/misc/navit/default.nix pkgs/applications/networking/mailreaders/alpine/default.nix pkgs/applications/networking/mailreaders/realpine/default.nix pkgs/development/compilers/ghc/head.nix pkgs/development/libraries/openssl/default.nix pkgs/games/liquidwar/default.nix pkgs/games/spring/springlobby.nix pkgs/os-specific/linux/kernel/perf.nix pkgs/servers/sip/freeswitch/default.nix pkgs/tools/archivers/cromfs/default.nix pkgs/tools/graphics/plotutils/default.nix
Diffstat (limited to 'nixos/modules/system')
-rw-r--r-- | nixos/modules/system/boot/stage-1.nix | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix index 9be7ad4ae077..a5c05f3dbbaf 100644 --- a/nixos/modules/system/boot/stage-1.nix +++ b/nixos/modules/system/boot/stage-1.nix @@ -3,7 +3,7 @@ # the modules necessary to mount the root file system, then calls the # init in the root file system to start the second boot stage. -{ config, lib, pkgs, ... }: +{ config, lib, utils, pkgs, ... }: with lib; @@ -23,6 +23,12 @@ 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 utils.fsNeededForBoot config.system.build.fileSystems; + + # Some additional utilities needed in stage 1, like mount, lvm, fsck # etc. We don't want to bring in all of those packages, so we just # copy what we need. Instead of using statically linked binaries, @@ -71,7 +77,7 @@ let ln -sf kmod $out/bin/modprobe # Copy resize2fs if needed. - ${optionalString (any (fs: fs.autoResize) (attrValues config.fileSystems)) '' + ${optionalString (any (fs: fs.autoResize) fileSystems) '' # We need mke2fs in the initrd. copy_bin_and_libs ${pkgs.e2fsprogs}/sbin/resize2fs ''} @@ -128,21 +134,6 @@ 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). - # - # 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 { name = "udev-rules"; allowedReferences = [ extraUtils ]; @@ -405,9 +396,8 @@ in }; config = mkIf (!config.boot.isContainer) { - assertions = [ - { assertion = any (fs: fs.mountPoint == "/") (attrValues config.fileSystems); + { assertion = any (fs: fs.mountPoint == "/") fileSystems; message = "The ‘fileSystems’ option does not specify your root file system."; } { assertion = let inherit (config.boot) resumeDevice; in |