From a4b1638f7fb936e3cf43b61bc98d1c30a3a97dda Mon Sep 17 00:00:00 2001 From: phaer Date: Thu, 5 Sep 2024 13:06:25 +0200 Subject: [PATCH] azure-image: use virtualisation.diskSize --- nixos/modules/virtualisation/azure-image.nix | 30 +++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/nixos/modules/virtualisation/azure-image.nix b/nixos/modules/virtualisation/azure-image.nix index 1f6b2bd52c04..4c321ad95fc8 100644 --- a/nixos/modules/virtualisation/azure-image.nix +++ b/nixos/modules/virtualisation/azure-image.nix @@ -8,20 +8,27 @@ with lib; let cfg = config.virtualisation.azureImage; + virtualisationOptions = import ./virtualisation-options.nix; in { - imports = [ ./azure-common.nix ]; + imports = [ + ./azure-common.nix + virtualisationOptions.diskSize + (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 +74,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; }; };