virtualisation/azure-image: add additionalSize option (#485252)

This commit is contained in:
Paul Haerle
2026-02-25 08:28:16 +00:00
committed by GitHub
+15 -1
View File
@@ -67,6 +67,16 @@ in
For v2, secure boot needs to be turned off during creation.
'';
};
additionalSpace = mkOption {
type = types.str;
default = "512M";
example = "2048M";
description = ''
additional disk space to be added to the image if diskSize "auto"
is used.
'';
};
};
config = {
@@ -81,8 +91,12 @@ in
# generating raw format and convert with subformat args afterwards
format = "raw";
postVM = ''
${pkgs.vmTools.qemu}/bin/qemu-img convert -f raw -o subformat=fixed,force_size -O vpc $diskImage $out/${config.image.fileName}
${lib.getExe' pkgs.vmTools.qemu "qemu-img"} convert -f raw -o subformat=fixed,force_size -O vpc $diskImage $out/${config.image.fileName}
rm $diskImage
''
+ lib.optionalString (cfg.diskSize == "auto") ''
truncate -s +${cfg.additionalSpace} "$out/${config.image.fileName}"
${lib.getExe' pkgs.cloud-utils "growpart"} "$out/${config.image.fileName}" 1
'';
configFile = ./azure-config-user.nix;