aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/nixos/modules/system/boot/stage-1.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/nixos/modules/system/boot/stage-1.nix')
-rw-r--r--nixpkgs/nixos/modules/system/boot/stage-1.nix35
1 files changed, 19 insertions, 16 deletions
diff --git a/nixpkgs/nixos/modules/system/boot/stage-1.nix b/nixpkgs/nixos/modules/system/boot/stage-1.nix
index dfd158e2d75..6823e12847c 100644
--- a/nixpkgs/nixos/modules/system/boot/stage-1.nix
+++ b/nixpkgs/nixos/modules/system/boot/stage-1.nix
@@ -36,7 +36,7 @@ let
set -euo pipefail
declare -A seen
- declare -a left
+ left=()
patchelf="${pkgs.buildPackages.patchelf}/bin/patchelf"
@@ -48,7 +48,7 @@ let
done
}
- add_needed $1
+ add_needed "$1"
while [ ''${#left[@]} -ne 0 ]; do
next=''${left[0]}
@@ -111,20 +111,21 @@ let
copy_bin_and_libs ${pkgs.utillinux}/sbin/blkid
# Copy dmsetup and lvm.
- copy_bin_and_libs ${pkgs.lvm2}/sbin/dmsetup
- copy_bin_and_libs ${pkgs.lvm2}/sbin/lvm
+ copy_bin_and_libs ${getBin pkgs.lvm2}/bin/dmsetup
+ copy_bin_and_libs ${getBin pkgs.lvm2}/bin/lvm
# Add RAID mdadm tool.
copy_bin_and_libs ${pkgs.mdadm}/sbin/mdadm
copy_bin_and_libs ${pkgs.mdadm}/sbin/mdmon
# Copy udev.
- copy_bin_and_libs ${udev}/lib/systemd/systemd-udevd
- copy_bin_and_libs ${udev}/lib/systemd/systemd-sysctl
copy_bin_and_libs ${udev}/bin/udevadm
+ copy_bin_and_libs ${udev}/lib/systemd/systemd-sysctl
for BIN in ${udev}/lib/udev/*_id; do
copy_bin_and_libs $BIN
done
+ # systemd-udevd is only a symlink to udevadm these days
+ ln -sf udevadm $out/bin/systemd-udevd
# Copy modprobe.
copy_bin_and_libs ${pkgs.kmod}/bin/kmod
@@ -235,7 +236,7 @@ let
--replace cdrom_id ${extraUtils}/bin/cdrom_id \
--replace ${pkgs.coreutils}/bin/basename ${extraUtils}/bin/basename \
--replace ${pkgs.utillinux}/bin/blkid ${extraUtils}/bin/blkid \
- --replace ${pkgs.lvm2}/sbin ${extraUtils}/bin \
+ --replace ${getBin pkgs.lvm2}/bin ${extraUtils}/bin \
--replace ${pkgs.mdadm}/sbin ${extraUtils}/sbin \
--replace ${pkgs.bash}/bin/sh ${extraUtils}/bin/sh \
--replace ${udev} ${extraUtils}
@@ -374,7 +375,8 @@ let
) config.boot.initrd.secrets)
}
- (cd "$tmp" && find . | cpio -H newc -o) | gzip >>"$1"
+ (cd "$tmp" && find . -print0 | sort -z | cpio -o -H newc -R +0:+0 --reproducible --null) | \
+ ${config.boot.initrd.compressor} >> "$1"
'';
in
@@ -517,8 +519,7 @@ in
};
boot.initrd.secrets = mkOption
- { internal = true;
- default = {};
+ { default = {};
type = types.attrsOf (types.nullOr types.path);
description =
''
@@ -555,15 +556,17 @@ in
};
fileSystems = mkOption {
- type = with lib.types; loaOf (submodule {
+ type = with lib.types; attrsOf (submodule {
options.neededForBoot = mkOption {
default = false;
type = types.bool;
description = ''
- If set, this file system will be mounted in the initial
- ramdisk. By default, this applies to the root file system
- and to the file system containing
- <filename>/nix/store</filename>.
+ If set, this file system will be mounted in the initial ramdisk.
+ Note that the file system will always be mounted in the initial
+ ramdisk if its mount point is one of the following:
+ ${concatStringsSep ", " (
+ forEach utils.pathsNeededForBoot (i: "<filename>${i}</filename>")
+ )}.
'';
};
});
@@ -585,7 +588,7 @@ in
{ assertion = !config.boot.loader.supportsInitrdSecrets ->
all (source:
builtins.isPath source ||
- (builtins.isString source && hasPrefix source builtins.storeDir))
+ (builtins.isString source && hasPrefix builtins.storeDir source))
(attrValues config.boot.initrd.secrets);
message = ''
boot.loader.initrd.secrets values must be unquoted paths when