Skip to content

Commit

Permalink
amazon-image: support VPC/VHD as an output format for the builder
Browse files Browse the repository at this point in the history
  • Loading branch information
copumpkin committed Aug 10, 2017
1 parent f3f8c58 commit 5f372ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions nixos/lib/make-disk-image.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@
with lib;

let
extensions = {
qcow2 = "qcow2";
vpc = "vhd";
raw = "img";
};

# Copied from https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/installer/cd-dvd/channel.nix
# TODO: factor out more cleanly

Expand Down Expand Up @@ -142,8 +148,8 @@ in pkgs.vmTools.runInLinuxVM (
mv $diskImage $out/nixos.img
diskImage=$out/nixos.img
'' else ''
${pkgs.qemu}/bin/qemu-img convert -f raw -O qcow2 $diskImage $out/nixos.qcow2
diskImage=$out/nixos.qcow2
${pkgs.qemu}/bin/qemu-img convert -f raw -O ${format} $diskImage $out/nixos.${extensions.${format}}
diskImage=$out/nixos.${extensions.${format}}
''}
${postVM}
'';
Expand Down
2 changes: 1 addition & 1 deletion nixos/maintainers/scripts/ec2/amazon-image.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ in {
};

format = mkOption {
type = types.enum [ "raw" "qcow2" ];
type = types.enum [ "raw" "qcow2" "vpc" ];
default = "qcow2";
description = "The image format to output";
};
Expand Down

0 comments on commit 5f372ef

Please sign in to comment.