3
0
Fork 0
forked from mirrors/nixpkgs

Revert "treewide: use nativeBuildInputs with runCommand instead of inlining"

This commit is contained in:
K900 2022-12-26 21:05:35 +03:00 committed by GitHub
parent d72cf7be48
commit 2d3cf010fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 46 deletions
nixos
lib/make-options-doc
modules
installer/tools/nixos-build-vms
misc
virtualisation
tests

View file

@ -93,19 +93,15 @@ let
in rec { in rec {
inherit optionsNix; inherit optionsNix;
optionsAsciiDoc = pkgs.runCommand "options.adoc" { optionsAsciiDoc = pkgs.runCommand "options.adoc" {} ''
nativeBuildInputs = [ pkgs.python3Minimal ]; ${pkgs.python3Minimal}/bin/python ${./generateDoc.py} \
} ''
python ${./generateDoc.py} \
--format asciidoc \ --format asciidoc \
${optionsJSON}/share/doc/nixos/options.json \ ${optionsJSON}/share/doc/nixos/options.json \
> $out > $out
''; '';
optionsCommonMark = pkgs.runCommand "options.md" { optionsCommonMark = pkgs.runCommand "options.md" {} ''
nativeBuildInputs = [ pkgs.python3Minimal ]; ${pkgs.python3Minimal}/bin/python ${./generateDoc.py} \
} ''
python ${./generateDoc.py} \
--format commonmark \ --format commonmark \
${optionsJSON}/share/doc/nixos/options.json \ ${optionsJSON}/share/doc/nixos/options.json \
> $out > $out
@ -157,20 +153,16 @@ in rec {
# Convert options.json into an XML file. # Convert options.json into an XML file.
# The actual generation of the xml file is done in nix purely for the convenience # The actual generation of the xml file is done in nix purely for the convenience
# of not having to generate the xml some other way # of not having to generate the xml some other way
optionsXML = pkgs.runCommand "options.xml" { optionsXML = pkgs.runCommand "options.xml" {} ''
nativeBuildInputs = with pkgs; [ nix ];
} ''
export NIX_STORE_DIR=$TMPDIR/store export NIX_STORE_DIR=$TMPDIR/store
export NIX_STATE_DIR=$TMPDIR/state export NIX_STATE_DIR=$TMPDIR/state
nix-instantiate \ ${pkgs.nix}/bin/nix-instantiate \
--eval --xml --strict ${./optionsJSONtoXML.nix} \ --eval --xml --strict ${./optionsJSONtoXML.nix} \
--argstr file ${optionsJSON}/share/doc/nixos/options.json \ --argstr file ${optionsJSON}/share/doc/nixos/options.json \
> "$out" > "$out"
''; '';
optionsDocBook = pkgs.runCommand "options-docbook.xml" { optionsDocBook = pkgs.runCommand "options-docbook.xml" {} ''
nativeBuildInputs = with pkgs; [ libxslt.bin libxslt.bin python3Minimal ];
} ''
optionsXML=${optionsXML} optionsXML=${optionsXML}
if grep /nixpkgs/nixos/modules $optionsXML; then if grep /nixpkgs/nixos/modules $optionsXML; then
echo "The manual appears to depend on the location of Nixpkgs, which is bad" echo "The manual appears to depend on the location of Nixpkgs, which is bad"
@ -180,14 +172,14 @@ in rec {
exit 1 exit 1
fi fi
python ${./sortXML.py} $optionsXML sorted.xml ${pkgs.python3Minimal}/bin/python ${./sortXML.py} $optionsXML sorted.xml
xsltproc \ ${pkgs.libxslt.bin}/bin/xsltproc \
--stringparam documentType '${documentType}' \ --stringparam documentType '${documentType}' \
--stringparam revision '${revision}' \ --stringparam revision '${revision}' \
--stringparam variablelistId '${variablelistId}' \ --stringparam variablelistId '${variablelistId}' \
--stringparam optionIdPrefix '${optionIdPrefix}' \ --stringparam optionIdPrefix '${optionIdPrefix}' \
-o intermediate.xml ${./options-to-docbook.xsl} sorted.xml -o intermediate.xml ${./options-to-docbook.xsl} sorted.xml
xsltproc \ ${pkgs.libxslt.bin}/bin/xsltproc \
-o "$out" ${./postprocess-option-descriptions.xsl} intermediate.xml -o "$out" ${./postprocess-option-descriptions.xsl} intermediate.xml
''; '';
} }

View file

@ -18,9 +18,8 @@ let
interactiveDriver = (testing.makeTest { inherit nodes; name = "network"; testScript = "start_all(); join_all();"; }).test.driverInteractive; interactiveDriver = (testing.makeTest { inherit nodes; name = "network"; testScript = "start_all(); join_all();"; }).test.driverInteractive;
in in
pkgs.runCommandLocal "nixos-build-vms" {
nativeBuildInputs = [ pkgs.makeWrapper ]; pkgs.runCommand "nixos-build-vms" { nativeBuildInputs = [ pkgs.makeWrapper ]; } ''
} ''
mkdir -p $out/bin mkdir -p $out/bin
ln -s ${interactiveDriver}/bin/nixos-test-driver $out/bin/nixos-test-driver ln -s ${interactiveDriver}/bin/nixos-test-driver $out/bin/nixos-test-driver
ln -s ${interactiveDriver}/bin/nixos-test-driver $out/bin/nixos-run-vms ln -s ${interactiveDriver}/bin/nixos-test-driver $out/bin/nixos-run-vms

View file

@ -77,11 +77,10 @@ let
pkgsLibPath = filter (pkgs.path + "/pkgs/pkgs-lib"); pkgsLibPath = filter (pkgs.path + "/pkgs/pkgs-lib");
nixosPath = filter (pkgs.path + "/nixos"); nixosPath = filter (pkgs.path + "/nixos");
modules = map (p: ''"${removePrefix "${modulesPath}/" (toString p)}"'') docModules.lazy; modules = map (p: ''"${removePrefix "${modulesPath}/" (toString p)}"'') docModules.lazy;
nativeBuildInputs = with pkgs; [ nix ];
} '' } ''
export NIX_STORE_DIR=$TMPDIR/store export NIX_STORE_DIR=$TMPDIR/store
export NIX_STATE_DIR=$TMPDIR/state export NIX_STATE_DIR=$TMPDIR/state
nix-instantiate \ ${pkgs.buildPackages.nix}/bin/nix-instantiate \
--show-trace \ --show-trace \
--eval --json --strict \ --eval --json --strict \
--argstr libPath "$libPath" \ --argstr libPath "$libPath" \

View file

@ -27,21 +27,21 @@ in
popd popd
''; '';
diskImageBase = "nixos-image-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}.raw"; diskImageBase = "nixos-image-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}.raw";
nativeBuildInputs = with pkgs; [ e2fsprogs parted ]; buildInputs = [ pkgs.util-linux pkgs.perl ];
buildInputs = with pkgs; [ util-linux perl ]; exportReferencesGraph =
exportReferencesGraph = [ "closure" config.system.build.toplevel ]; [ "closure" config.system.build.toplevel ];
} }
'' ''
# Create partition table # Create partition table
parted --script /dev/vda mklabel msdos ${pkgs.parted}/sbin/parted --script /dev/vda mklabel msdos
parted --script /dev/vda mkpart primary ext4 1 ${diskSize} ${pkgs.parted}/sbin/parted --script /dev/vda mkpart primary ext4 1 ${diskSize}
parted --script /dev/vda print ${pkgs.parted}/sbin/parted --script /dev/vda print
. /sys/class/block/vda1/uevent . /sys/class/block/vda1/uevent
mknod /dev/vda1 b $MAJOR $MINOR mknod /dev/vda1 b $MAJOR $MINOR
# Create an empty filesystem and mount it. # Create an empty filesystem and mount it.
mkfs.ext4 -L nixos /dev/vda1 ${pkgs.e2fsprogs}/sbin/mkfs.ext4 -L nixos /dev/vda1
tune2fs -c 0 -i 0 /dev/vda1 ${pkgs.e2fsprogs}/sbin/tune2fs -c 0 -i 0 /dev/vda1
mkdir /mnt mkdir /mnt
mount /dev/vda1 /mnt mount /dev/vda1 /mnt

View file

@ -218,8 +218,7 @@ let
chmod 0644 $efiVars chmod 0644 $efiVars
'' else ""} '' else ""}
''; '';
nativeBuildInputs = with pkgs; [ dosfstools gptfdisk kmod mtools ]; buildInputs = [ pkgs.util-linux ];
buildInputs = with pkgs; [ util-linux ];
QEMU_OPTS = "-nographic -serial stdio -monitor none" QEMU_OPTS = "-nographic -serial stdio -monitor none"
+ lib.optionalString cfg.useEFIBoot ( + lib.optionalString cfg.useEFIBoot (
" -drive if=pflash,format=raw,unit=0,readonly=on,file=${cfg.efi.firmware}" " -drive if=pflash,format=raw,unit=0,readonly=on,file=${cfg.efi.firmware}"
@ -227,7 +226,7 @@ let
} }
'' ''
# Create a /boot EFI partition with 60M and arbitrary but fixed GUIDs for reproducibility # Create a /boot EFI partition with 60M and arbitrary but fixed GUIDs for reproducibility
sgdisk \ ${pkgs.gptfdisk}/bin/sgdisk \
--set-alignment=1 --new=1:34:2047 --change-name=1:BIOSBootPartition --typecode=1:ef02 \ --set-alignment=1 --new=1:34:2047 --change-name=1:BIOSBootPartition --typecode=1:ef02 \
--set-alignment=512 --largest-new=2 --change-name=2:EFISystem --typecode=2:ef00 \ --set-alignment=512 --largest-new=2 --change-name=2:EFISystem --typecode=2:ef00 \
--attributes=1:set:1 \ --attributes=1:set:1 \
@ -250,16 +249,16 @@ let
'' ''
} }
mkfs.fat -F16 /dev/vda2 ${pkgs.dosfstools}/bin/mkfs.fat -F16 /dev/vda2
export MTOOLS_SKIP_CHECK=1 export MTOOLS_SKIP_CHECK=1
mlabel -i /dev/vda2 ::boot ${pkgs.mtools}/bin/mlabel -i /dev/vda2 ::boot
# Mount /boot; load necessary modules first. # Mount /boot; load necessary modules first.
insmod ${pkgs.linux}/lib/modules/*/kernel/fs/nls/nls_cp437.ko.xz || true ${pkgs.kmod}/bin/insmod ${pkgs.linux}/lib/modules/*/kernel/fs/nls/nls_cp437.ko.xz || true
insmod ${pkgs.linux}/lib/modules/*/kernel/fs/nls/nls_iso8859-1.ko.xz || true ${pkgs.kmod}/bin/insmod ${pkgs.linux}/lib/modules/*/kernel/fs/nls/nls_iso8859-1.ko.xz || true
insmod ${pkgs.linux}/lib/modules/*/kernel/fs/fat/fat.ko.xz || true ${pkgs.kmod}/bin/insmod ${pkgs.linux}/lib/modules/*/kernel/fs/fat/fat.ko.xz || true
insmod ${pkgs.linux}/lib/modules/*/kernel/fs/fat/vfat.ko.xz || true ${pkgs.kmod}/bin/insmod ${pkgs.linux}/lib/modules/*/kernel/fs/fat/vfat.ko.xz || true
insmod ${pkgs.linux}/lib/modules/*/kernel/fs/efivarfs/efivarfs.ko.xz || true ${pkgs.kmod}/bin/insmod ${pkgs.linux}/lib/modules/*/kernel/fs/efivarfs/efivarfs.ko.xz || true
mkdir /boot mkdir /boot
mount /dev/vda2 /boot mount /dev/vda2 /boot

View file

@ -1,13 +1,11 @@
import ./make-test-python.nix ({ pkgs, ... }: import ./make-test-python.nix ({ pkgs, ... }:
let let
test-certificates = pkgs.runCommandLocal "test-certificates" { test-certificates = pkgs.runCommandLocal "test-certificates" { } ''
nativeBuildInputs = with pkgs; [ step-cli ];
} ''
mkdir -p $out mkdir -p $out
echo insecure-root-password > $out/root-password-file echo insecure-root-password > $out/root-password-file
echo insecure-intermediate-password > $out/intermediate-password-file echo insecure-intermediate-password > $out/intermediate-password-file
step certificate create "Example Root CA" $out/root_ca.crt $out/root_ca.key --password-file=$out/root-password-file --profile root-ca ${pkgs.step-cli}/bin/step certificate create "Example Root CA" $out/root_ca.crt $out/root_ca.key --password-file=$out/root-password-file --profile root-ca
step certificate create "Example Intermediate CA 1" $out/intermediate_ca.crt $out/intermediate_ca.key --password-file=$out/intermediate-password-file --ca-password-file=$out/root-password-file --profile intermediate-ca --ca $out/root_ca.crt --ca-key $out/root_ca.key ${pkgs.step-cli}/bin/step certificate create "Example Intermediate CA 1" $out/intermediate_ca.crt $out/intermediate_ca.key --password-file=$out/intermediate-password-file --ca-password-file=$out/root-password-file --profile intermediate-ca --ca $out/root_ca.crt --ca-key $out/root_ca.key
''; '';
in in
{ {