diff options
author | Sandro Jäckel <sandro.jaeckel@gmail.com> | 2022-12-18 23:35:29 +0100 |
---|---|---|
committer | Sandro Jäckel <sandro.jaeckel@gmail.com> | 2022-12-18 23:36:40 +0100 |
commit | 26f704b545838084e334f37d434a648c0c564ffd (patch) | |
tree | 116e9689e8af6d6ee7e7c3d23e63dc7aa2cc8f97 /nixos/modules/virtualisation | |
parent | 76672661b9b8cf731e2cd87984f701937e8df655 (diff) |
treewide: use nativeBuildInputs with runCommand instead of inlining
Diffstat (limited to 'nixos/modules/virtualisation')
-rw-r--r-- | nixos/modules/virtualisation/brightbox-image.nix | 16 | ||||
-rw-r--r-- | nixos/modules/virtualisation/qemu-vm.nix | 19 |
2 files changed, 18 insertions, 17 deletions
diff --git a/nixos/modules/virtualisation/brightbox-image.nix b/nixos/modules/virtualisation/brightbox-image.nix index 9641b693f1847..004b7ded0d5a9 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 1b3c0e23f97db..51ac85b0a4f4a 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 |