amazon-image: support VPC/VHD as an output format for the builder
This commit is contained in:
parent
f3f8c584a4
commit
5f372ef67f
@ -39,6 +39,12 @@
|
|||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
extensions = {
|
||||||
|
qcow2 = "qcow2";
|
||||||
|
vpc = "vhd";
|
||||||
|
raw = "img";
|
||||||
|
};
|
||||||
|
|
||||||
# Copied from https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/installer/cd-dvd/channel.nix
|
# Copied from https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/installer/cd-dvd/channel.nix
|
||||||
# TODO: factor out more cleanly
|
# TODO: factor out more cleanly
|
||||||
|
|
||||||
@ -142,8 +148,8 @@ in pkgs.vmTools.runInLinuxVM (
|
|||||||
mv $diskImage $out/nixos.img
|
mv $diskImage $out/nixos.img
|
||||||
diskImage=$out/nixos.img
|
diskImage=$out/nixos.img
|
||||||
'' else ''
|
'' else ''
|
||||||
${pkgs.qemu}/bin/qemu-img convert -f raw -O qcow2 $diskImage $out/nixos.qcow2
|
${pkgs.qemu}/bin/qemu-img convert -f raw -O ${format} $diskImage $out/nixos.${extensions.${format}}
|
||||||
diskImage=$out/nixos.qcow2
|
diskImage=$out/nixos.${extensions.${format}}
|
||||||
''}
|
''}
|
||||||
${postVM}
|
${postVM}
|
||||||
'';
|
'';
|
||||||
|
@ -24,7 +24,7 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
format = mkOption {
|
format = mkOption {
|
||||||
type = types.enum [ "raw" "qcow2" ];
|
type = types.enum [ "raw" "qcow2" "vpc" ];
|
||||||
default = "qcow2";
|
default = "qcow2";
|
||||||
description = "The image format to output";
|
description = "The image format to output";
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user