3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #228801 from NixOS/make-disk-image-faster

nixos/lib/make-disk-image: do not compile a full arch QEMU to convert images
This commit is contained in:
Ryan Lahfa 2023-05-15 13:24:08 +02:00 committed by GitHub
commit 5a7e90bc95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 9 deletions

View file

@ -511,7 +511,7 @@ let format' = format; in let
${if format == "raw" then '' ${if format == "raw" then ''
mv $diskImage $out/${filename} mv $diskImage $out/${filename}
'' else '' '' else ''
${pkgs.qemu}/bin/qemu-img convert -f raw -O ${format} ${compress} $diskImage $out/${filename} ${pkgs.qemu-utils}/bin/qemu-img convert -f raw -O ${format} ${compress} $diskImage $out/${filename}
''} ''}
diskImage=$out/${filename} diskImage=$out/${filename}
''; '';

View file

@ -261,8 +261,8 @@ let
mv $bootDiskImage $out/${bootFilename} mv $bootDiskImage $out/${bootFilename}
mv $rootDiskImage $out/${rootFilename} mv $rootDiskImage $out/${rootFilename}
'' else '' '' else ''
${pkgs.qemu}/bin/qemu-img convert -f raw -O ${formatOpt} ${compress} $bootDiskImage $out/${bootFilename} ${pkgs.qemu_kvm}/bin/qemu-img convert -f raw -O ${formatOpt} ${compress} $bootDiskImage $out/${bootFilename}
${pkgs.qemu}/bin/qemu-img convert -f raw -O ${formatOpt} ${compress} $rootDiskImage $out/${rootFilename} ${pkgs.qemu_kvm}/bin/qemu-img convert -f raw -O ${formatOpt} ${compress} $rootDiskImage $out/${rootFilename}
''} ''}
bootDiskImage=$out/${bootFilename} bootDiskImage=$out/${bootFilename}
rootDiskImage=$out/${rootFilename} rootDiskImage=$out/${rootFilename}

View file

@ -244,7 +244,7 @@ let
${if formatOpt == "raw" then '' ${if formatOpt == "raw" then ''
mv $rootDiskImage $out/${rootFilename} mv $rootDiskImage $out/${rootFilename}
'' else '' '' else ''
${pkgs.qemu}/bin/qemu-img convert -f raw -O ${formatOpt} ${compress} $rootDiskImage $out/${rootFilename} ${pkgs.qemu_kvm}/bin/qemu-img convert -f raw -O ${formatOpt} ${compress} $rootDiskImage $out/${rootFilename}
''} ''}
rootDiskImage=$out/${rootFilename} rootDiskImage=$out/${rootFilename}
set -x set -x

View file

@ -102,8 +102,8 @@ in {
${pkgs.jq}/bin/jq -n \ ${pkgs.jq}/bin/jq -n \
--arg system_label ${lib.escapeShellArg config.system.nixos.label} \ --arg system_label ${lib.escapeShellArg config.system.nixos.label} \
--arg system ${lib.escapeShellArg pkgs.stdenv.hostPlatform.system} \ --arg system ${lib.escapeShellArg pkgs.stdenv.hostPlatform.system} \
--arg root_logical_bytes "$(${pkgs.qemu}/bin/qemu-img info --output json "$rootDisk" | ${pkgs.jq}/bin/jq '."virtual-size"')" \ --arg root_logical_bytes "$(${pkgs.qemu_kvm}/bin/qemu-img info --output json "$rootDisk" | ${pkgs.jq}/bin/jq '."virtual-size"')" \
--arg boot_logical_bytes "$(${pkgs.qemu}/bin/qemu-img info --output json "$bootDisk" | ${pkgs.jq}/bin/jq '."virtual-size"')" \ --arg boot_logical_bytes "$(${pkgs.qemu_kvm}/bin/qemu-img info --output json "$bootDisk" | ${pkgs.jq}/bin/jq '."virtual-size"')" \
--arg boot_mode "${amiBootMode}" \ --arg boot_mode "${amiBootMode}" \
--arg root "$rootDisk" \ --arg root "$rootDisk" \
--arg boot "$bootDisk" \ --arg boot "$bootDisk" \
@ -142,7 +142,7 @@ in {
${pkgs.jq}/bin/jq -n \ ${pkgs.jq}/bin/jq -n \
--arg system_label ${lib.escapeShellArg config.system.nixos.label} \ --arg system_label ${lib.escapeShellArg config.system.nixos.label} \
--arg system ${lib.escapeShellArg pkgs.stdenv.hostPlatform.system} \ --arg system ${lib.escapeShellArg pkgs.stdenv.hostPlatform.system} \
--arg logical_bytes "$(${pkgs.qemu}/bin/qemu-img info --output json "$diskImage" | ${pkgs.jq}/bin/jq '."virtual-size"')" \ --arg logical_bytes "$(${pkgs.qemu_kvm}/bin/qemu-img info --output json "$diskImage" | ${pkgs.jq}/bin/jq '."virtual-size"')" \
--arg boot_mode "${amiBootMode}" \ --arg boot_mode "${amiBootMode}" \
--arg file "$diskImage" \ --arg file "$diskImage" \
'{} '{}

View file

@ -85,7 +85,7 @@ in
${pkgs.jq}/bin/jq -n \ ${pkgs.jq}/bin/jq -n \
--arg system_label ${lib.escapeShellArg config.system.nixos.label} \ --arg system_label ${lib.escapeShellArg config.system.nixos.label} \
--arg system ${lib.escapeShellArg pkgs.stdenv.hostPlatform.system} \ --arg system ${lib.escapeShellArg pkgs.stdenv.hostPlatform.system} \
--arg root_logical_bytes "$(${pkgs.qemu}/bin/qemu-img info --output json "$rootDisk" | ${pkgs.jq}/bin/jq '."virtual-size"')" \ --arg root_logical_bytes "$(${pkgs.qemu_kvm}/bin/qemu-img info --output json "$rootDisk" | ${pkgs.jq}/bin/jq '."virtual-size"')" \
--arg boot_mode "${imageBootMode}" \ --arg boot_mode "${imageBootMode}" \
--arg root "$rootDisk" \ --arg root "$rootDisk" \
'{} '{}

View file

@ -21,7 +21,7 @@ let
shutil.copyfile("${machine.system.build.diskImage}/nixos.img", tmp_disk_image.name) shutil.copyfile("${machine.system.build.diskImage}/nixos.img", tmp_disk_image.name)
subprocess.run([ subprocess.run([
"${pkgs.qemu}/bin/qemu-img", "${machine.config.virtualisation.qemu.package}/bin/qemu-img",
"resize", "resize",
"-f", "-f",
"raw", "raw",