diff options
author | Sandro <sandro.jaeckel@gmail.com> | 2022-12-25 21:42:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-25 21:42:05 +0100 |
commit | 5af3f865e84ecc9baa846ec1d85cc7192f0d3543 (patch) | |
tree | 98c50c657c4801854f16ee8cbb2661a292c7d972 /nixos | |
parent | f3ae2deafb0dd0c5dd4fb2716dcda83b209bd719 (diff) | |
parent | 26f704b545838084e334f37d434a648c0c564ffd (diff) | |
download | nixlib-5af3f865e84ecc9baa846ec1d85cc7192f0d3543.tar nixlib-5af3f865e84ecc9baa846ec1d85cc7192f0d3543.tar.gz nixlib-5af3f865e84ecc9baa846ec1d85cc7192f0d3543.tar.bz2 nixlib-5af3f865e84ecc9baa846ec1d85cc7192f0d3543.tar.lz nixlib-5af3f865e84ecc9baa846ec1d85cc7192f0d3543.tar.xz nixlib-5af3f865e84ecc9baa846ec1d85cc7192f0d3543.tar.zst nixlib-5af3f865e84ecc9baa846ec1d85cc7192f0d3543.zip |
Merge pull request #206775 from SuperSandro2000/runCommand-nativeBuildInputs
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/lib/make-options-doc/default.nix | 28 | ||||
-rw-r--r-- | nixos/modules/installer/tools/nixos-build-vms/build-vms.nix | 5 | ||||
-rw-r--r-- | nixos/modules/misc/documentation.nix | 3 | ||||
-rw-r--r-- | nixos/modules/virtualisation/brightbox-image.nix | 16 | ||||
-rw-r--r-- | nixos/modules/virtualisation/qemu-vm.nix | 19 | ||||
-rw-r--r-- | nixos/tests/step-ca.nix | 8 |
6 files changed, 46 insertions, 33 deletions
diff --git a/nixos/lib/make-options-doc/default.nix b/nixos/lib/make-options-doc/default.nix index a3436caad8f9..a5e91a31b8bf 100644 --- a/nixos/lib/make-options-doc/default.nix +++ b/nixos/lib/make-options-doc/default.nix @@ -93,15 +93,19 @@ let in rec { inherit optionsNix; - optionsAsciiDoc = pkgs.runCommand "options.adoc" {} '' - ${pkgs.python3Minimal}/bin/python ${./generateDoc.py} \ + optionsAsciiDoc = pkgs.runCommand "options.adoc" { + nativeBuildInputs = [ pkgs.python3Minimal ]; + } '' + python ${./generateDoc.py} \ --format asciidoc \ ${optionsJSON}/share/doc/nixos/options.json \ > $out ''; - optionsCommonMark = pkgs.runCommand "options.md" {} '' - ${pkgs.python3Minimal}/bin/python ${./generateDoc.py} \ + optionsCommonMark = pkgs.runCommand "options.md" { + nativeBuildInputs = [ pkgs.python3Minimal ]; + } '' + python ${./generateDoc.py} \ --format commonmark \ ${optionsJSON}/share/doc/nixos/options.json \ > $out @@ -153,16 +157,20 @@ in rec { # Convert options.json into an XML file. # 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 - optionsXML = pkgs.runCommand "options.xml" {} '' + optionsXML = pkgs.runCommand "options.xml" { + nativeBuildInputs = with pkgs; [ nix ]; + } '' export NIX_STORE_DIR=$TMPDIR/store export NIX_STATE_DIR=$TMPDIR/state - ${pkgs.nix}/bin/nix-instantiate \ + nix-instantiate \ --eval --xml --strict ${./optionsJSONtoXML.nix} \ --argstr file ${optionsJSON}/share/doc/nixos/options.json \ > "$out" ''; - optionsDocBook = pkgs.runCommand "options-docbook.xml" {} '' + optionsDocBook = pkgs.runCommand "options-docbook.xml" { + nativeBuildInputs = with pkgs; [ libxslt.bin libxslt.bin python3Minimal ]; + } '' optionsXML=${optionsXML} if grep /nixpkgs/nixos/modules $optionsXML; then echo "The manual appears to depend on the location of Nixpkgs, which is bad" @@ -172,14 +180,14 @@ in rec { exit 1 fi - ${pkgs.python3Minimal}/bin/python ${./sortXML.py} $optionsXML sorted.xml - ${pkgs.libxslt.bin}/bin/xsltproc \ + python ${./sortXML.py} $optionsXML sorted.xml + xsltproc \ --stringparam documentType '${documentType}' \ --stringparam revision '${revision}' \ --stringparam variablelistId '${variablelistId}' \ --stringparam optionIdPrefix '${optionIdPrefix}' \ -o intermediate.xml ${./options-to-docbook.xsl} sorted.xml - ${pkgs.libxslt.bin}/bin/xsltproc \ + xsltproc \ -o "$out" ${./postprocess-option-descriptions.xsl} intermediate.xml ''; } diff --git a/nixos/modules/installer/tools/nixos-build-vms/build-vms.nix b/nixos/modules/installer/tools/nixos-build-vms/build-vms.nix index 21a257378a63..6bcf6c99545a 100644 --- a/nixos/modules/installer/tools/nixos-build-vms/build-vms.nix +++ b/nixos/modules/installer/tools/nixos-build-vms/build-vms.nix @@ -18,8 +18,9 @@ let interactiveDriver = (testing.makeTest { inherit nodes; name = "network"; testScript = "start_all(); join_all();"; }).test.driverInteractive; in - -pkgs.runCommand "nixos-build-vms" { nativeBuildInputs = [ pkgs.makeWrapper ]; } '' + pkgs.runCommandLocal "nixos-build-vms" { + nativeBuildInputs = [ pkgs.makeWrapper ]; + } '' 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-run-vms diff --git a/nixos/modules/misc/documentation.nix b/nixos/modules/misc/documentation.nix index 64a8f7846b46..1557bf4bd3e2 100644 --- a/nixos/modules/misc/documentation.nix +++ b/nixos/modules/misc/documentation.nix @@ -77,10 +77,11 @@ let pkgsLibPath = filter (pkgs.path + "/pkgs/pkgs-lib"); nixosPath = filter (pkgs.path + "/nixos"); modules = map (p: ''"${removePrefix "${modulesPath}/" (toString p)}"'') docModules.lazy; + nativeBuildInputs = with pkgs; [ nix ]; } '' export NIX_STORE_DIR=$TMPDIR/store export NIX_STATE_DIR=$TMPDIR/state - ${pkgs.buildPackages.nix}/bin/nix-instantiate \ + nix-instantiate \ --show-trace \ --eval --json --strict \ --argstr libPath "$libPath" \ diff --git a/nixos/modules/virtualisation/brightbox-image.nix b/nixos/modules/virtualisation/brightbox-image.nix index 9641b693f184..004b7ded0d5a 100644 --- a/nixos/modules/virtualisation/brightbox-image.nix +++ b/nixos/modules/virtualisation/brightbox-image.nix @@ -27,21 +27,21 @@ in popd ''; diskImageBase = "nixos-image-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}.raw"; - buildInputs = [ pkgs.util-linux pkgs.perl ]; - exportReferencesGraph = - [ "closure" config.system.build.toplevel ]; + nativeBuildInputs = with pkgs; [ e2fsprogs parted ]; + buildInputs = with pkgs; [ util-linux perl ]; + exportReferencesGraph = [ "closure" config.system.build.toplevel ]; } '' # Create partition table - ${pkgs.parted}/sbin/parted --script /dev/vda mklabel msdos - ${pkgs.parted}/sbin/parted --script /dev/vda mkpart primary ext4 1 ${diskSize} - ${pkgs.parted}/sbin/parted --script /dev/vda print + parted --script /dev/vda mklabel msdos + parted --script /dev/vda mkpart primary ext4 1 ${diskSize} + parted --script /dev/vda print . /sys/class/block/vda1/uevent mknod /dev/vda1 b $MAJOR $MINOR # Create an empty filesystem and mount it. - ${pkgs.e2fsprogs}/sbin/mkfs.ext4 -L nixos /dev/vda1 - ${pkgs.e2fsprogs}/sbin/tune2fs -c 0 -i 0 /dev/vda1 + mkfs.ext4 -L nixos /dev/vda1 + tune2fs -c 0 -i 0 /dev/vda1 mkdir /mnt mount /dev/vda1 /mnt diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix index 1b3c0e23f97d..51ac85b0a4f4 100644 --- a/nixos/modules/virtualisation/qemu-vm.nix +++ b/nixos/modules/virtualisation/qemu-vm.nix @@ -218,7 +218,8 @@ let chmod 0644 $efiVars '' else ""} ''; - buildInputs = [ pkgs.util-linux ]; + nativeBuildInputs = with pkgs; [ dosfstools gptfdisk kmod mtools ]; + buildInputs = with pkgs; [ util-linux ]; QEMU_OPTS = "-nographic -serial stdio -monitor none" + lib.optionalString cfg.useEFIBoot ( " -drive if=pflash,format=raw,unit=0,readonly=on,file=${cfg.efi.firmware}" @@ -226,7 +227,7 @@ let } '' # Create a /boot EFI partition with 60M and arbitrary but fixed GUIDs for reproducibility - ${pkgs.gptfdisk}/bin/sgdisk \ + sgdisk \ --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 \ --attributes=1:set:1 \ @@ -249,16 +250,16 @@ let '' } - ${pkgs.dosfstools}/bin/mkfs.fat -F16 /dev/vda2 + mkfs.fat -F16 /dev/vda2 export MTOOLS_SKIP_CHECK=1 - ${pkgs.mtools}/bin/mlabel -i /dev/vda2 ::boot + mlabel -i /dev/vda2 ::boot # Mount /boot; load necessary modules first. - ${pkgs.kmod}/bin/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_iso8859-1.ko.xz || true - ${pkgs.kmod}/bin/insmod ${pkgs.linux}/lib/modules/*/kernel/fs/fat/fat.ko.xz || true - ${pkgs.kmod}/bin/insmod ${pkgs.linux}/lib/modules/*/kernel/fs/fat/vfat.ko.xz || true - ${pkgs.kmod}/bin/insmod ${pkgs.linux}/lib/modules/*/kernel/fs/efivarfs/efivarfs.ko.xz || true + 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 + insmod ${pkgs.linux}/lib/modules/*/kernel/fs/fat/fat.ko.xz || true + insmod ${pkgs.linux}/lib/modules/*/kernel/fs/fat/vfat.ko.xz || true + insmod ${pkgs.linux}/lib/modules/*/kernel/fs/efivarfs/efivarfs.ko.xz || true mkdir /boot mount /dev/vda2 /boot diff --git a/nixos/tests/step-ca.nix b/nixos/tests/step-ca.nix index a855b590232d..d4e1c1ae0144 100644 --- a/nixos/tests/step-ca.nix +++ b/nixos/tests/step-ca.nix @@ -1,11 +1,13 @@ import ./make-test-python.nix ({ pkgs, ... }: let - test-certificates = pkgs.runCommandLocal "test-certificates" { } '' + test-certificates = pkgs.runCommandLocal "test-certificates" { + nativeBuildInputs = with pkgs; [ step-cli ]; + } '' mkdir -p $out echo insecure-root-password > $out/root-password-file echo insecure-intermediate-password > $out/intermediate-password-file - ${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 - ${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 + 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 ''; in { |