modules/virtualisation: add unified diskSize opt

See https://github.com/NixOS/nixpkgs/pull/339535 and https://github.com/NixOS/nixpkgs/pull/341058
This commit is contained in:
phaer 2024-09-10 19:14:43 +02:00
parent 6071ee8e31
commit c6da9ef32d
14 changed files with 231 additions and 117 deletions

View file

@ -10,18 +10,24 @@ let
cfg = config.virtualisation.azureImage;
in
{
imports = [ ./azure-common.nix ];
imports = [
./azure-common.nix
./disk-size-option.nix
(lib.mkRenamedOptionModuleWith {
sinceRelease = 2411;
from = [
"virtualisation"
"azureImage"
"diskSize"
];
to = [
"virtualisation"
"diskSize"
];
})
];
options.virtualisation.azureImage = {
diskSize = mkOption {
type = with types; either (enum [ "auto" ]) int;
default = "auto";
example = 2048;
description = ''
Size of disk image. Unit is MB.
'';
};
bootSize = mkOption {
type = types.int;
default = 256;
@ -67,7 +73,8 @@ in
bootSize = "${toString cfg.bootSize}M";
partitionTableType = if cfg.vmGeneration == "v2" then "efi" else "legacy";
inherit (cfg) diskSize contents;
inherit (cfg) contents;
inherit (config.virtualisation) diskSize;
inherit config lib pkgs;
};
};