2020-04-24 23:36:52 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.virtualisation.azureImage;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
imports = [ ./azure-common.nix ];
|
2020-08-20 17:08:02 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
options = {
|
|
|
|
virtualisation.azureImage.diskSize = mkOption {
|
2021-04-26 19:14:03 +00:00
|
|
|
type = with types; either (enum [ "auto" ]) int;
|
|
|
|
default = "auto";
|
|
|
|
example = 2048;
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
Size of disk image. Unit is MB.
|
|
|
|
'';
|
|
|
|
};
|
2023-10-09 19:29:22 +00:00
|
|
|
virtualisation.azureImage.contents = mkOption {
|
|
|
|
type = with types; listOf attrs;
|
|
|
|
default = [ ];
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
2023-10-09 19:29:22 +00:00
|
|
|
Extra contents to add to the image.
|
|
|
|
'';
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
config = {
|
|
|
|
system.build.azureImage = import ../../lib/make-disk-image.nix {
|
|
|
|
name = "azure-image";
|
|
|
|
postVM = ''
|
|
|
|
${pkgs.vmTools.qemu}/bin/qemu-img convert -f raw -o subformat=fixed,force_size -O vpc $diskImage $out/disk.vhd
|
|
|
|
rm $diskImage
|
|
|
|
'';
|
|
|
|
configFile = ./azure-config-user.nix;
|
|
|
|
format = "raw";
|
2023-10-09 19:29:22 +00:00
|
|
|
inherit (cfg) diskSize contents;
|
2020-04-24 23:36:52 +00:00
|
|
|
inherit config lib pkgs;
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|