mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 23:43:30 +00:00
Merge pull request #168814 from helsinki-systems/feat/systemd-stage-1-pass-vars
nixos/systemd-stage-1: Pass more vars to the builder
This commit is contained in:
commit
031b95e587
@ -125,6 +125,9 @@ let
|
||||
};
|
||||
|
||||
initialRamdisk = pkgs.makeInitrdNG {
|
||||
name = "initrd-${kernel-name}";
|
||||
inherit (config.boot.initrd) compressor compressorArgs prepend;
|
||||
|
||||
contents = map (path: { object = path; symlink = ""; }) (subtractLists cfg.suppressedStorePaths cfg.storePaths)
|
||||
++ mapAttrsToList (_: v: { object = v.source; symlink = v.target; }) (filterAttrs (_: v: v.enable) cfg.contents);
|
||||
};
|
||||
|
@ -66,14 +66,28 @@ in
|
||||
compressorArgs = _compressorArgsReal;
|
||||
};
|
||||
|
||||
inherit extension makeUInitrd uInitrdArch prepend;
|
||||
${if makeUInitrd then "uInitrdCompression" else null} = uInitrdCompression;
|
||||
|
||||
passAsFile = ["contents"];
|
||||
contents = lib.concatMapStringsSep "\n" ({ object, symlink, ... }: "${object}\n${if symlink == null then "" else symlink}") contents + "\n";
|
||||
|
||||
nativeBuildInputs = [makeInitrdNGTool patchelf glibc cpio];
|
||||
nativeBuildInputs = [makeInitrdNGTool patchelf glibc cpio] ++ lib.optional makeUInitrd ubootTools;
|
||||
} ''
|
||||
mkdir ./root
|
||||
make-initrd-ng "$contentsPath" ./root
|
||||
mkdir "$out"
|
||||
(cd root && find * .[^.*] -exec touch -h -d '@1' '{}' +)
|
||||
for PREP in $prepend; do
|
||||
cat $PREP >> $out/initrd
|
||||
done
|
||||
(cd root && find * .[^.*] -print0 | sort -z | cpio -o -H newc -R +0:+0 --reproducible --null | eval -- $compress >> "$out/initrd")
|
||||
|
||||
if [ -n "$makeUInitrd" ]; then
|
||||
mkimage -A "$uInitrdArch" -O linux -T ramdisk -C "$uInitrdCompression" -d "$out/initrd" $out/initrd.img
|
||||
# Compatibility symlink
|
||||
ln -sf "initrd.img" "$out/initrd"
|
||||
else
|
||||
ln -s "initrd" "$out/initrd$extension"
|
||||
fi
|
||||
''
|
||||
|
Loading…
Reference in New Issue
Block a user