Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

virtualisation/hyperv-image: remove diskImage after vhdx is generated #88470

Merged
merged 1 commit into from May 21, 2020

Conversation

evanjs
Copy link
Member

@evanjs evanjs commented May 21, 2020

Motivation for this change

Remove the baseImage after the VHDX is generated.

I simply copied the approach taken here

postVM = ''
${pkgs.vmTools.qemu}/bin/qemu-img convert -f raw -o subformat=fixed,force_size -O vpc $diskImage $out/disk.vhd
rm $diskImage
'';

This was discovered when implementing nix-community/nixos-generators#53


This PR solves two issues:

  • We remove the extraneous base image and leave only the VHDX

These are quite large, even with a bare-bones configuration

dr-xr-xr-x root root   3.4 KB Wed Dec 31 19:00:01 1969  .
drwxrwxr-t root nixbld  16 MB Wed May 20 19:34:11 2020  ..
.r--r--r-- root root   1.4 GB Wed Dec 31 19:00:01 1969  nixos-20.09pre226148.0f5ce2fac0c-x86_64-linux.vhdx
.r--r--r-- root root     2 GB Wed Dec 31 19:00:01 1969  nixos.img
  • The VHDX image is printed after nixos-generate completes
    This prints something like /nix/store/36v2px1ca3k2x9q90cr8xzk5bvaqij0v-nixos-hyperv-20.09pre-git-x86_64-linux/nixos-20.09pre-git-x86_64-linux.vhdx
    rather than /nix/store/bx4132wc00d8dg10krslzh27bjm93sf7-nixos-hyperv-20.09pre226148.0f5ce2fac0c-x86_64-linux/nixos.img.

Previously, the base image we were converting would be printed upon image generation.
Now, we are properly given the VHDX file.


Things done

image

@offlinehacker offlinehacker merged commit 9d4e349 into NixOS:master May 21, 2020
@evanjs evanjs deleted the hyperv-remove-base-diskimage branch May 21, 2020 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants