From d223461d54375b33221ee95f9361581d1fdd8fe3 Mon Sep 17 00:00:00 2001 From: phaer Date: Thu, 5 Sep 2024 13:06:39 +0200 Subject: [PATCH] digital-ocean-image: use virtualisation.diskSize This makes negative diskSizes, that were previously allowed illegal. --- .../virtualisation/digital-ocean-image.nix | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/nixos/modules/virtualisation/digital-ocean-image.nix b/nixos/modules/virtualisation/digital-ocean-image.nix index 2d06c4c38fa1..597f2c2f7a3f 100644 --- a/nixos/modules/virtualisation/digital-ocean-image.nix +++ b/nixos/modules/virtualisation/digital-ocean-image.nix @@ -8,21 +8,28 @@ with lib; let cfg = config.virtualisation.digitalOceanImage; + virtualisationOptions = import ./virtualisation-options.nix; in { - imports = [ ./digital-ocean-config.nix ]; + imports = [ + ./digital-ocean-config.nix + virtualisationOptions.diskSize + (lib.mkRenamedOptionModuleWith { + sinceRelease = 2411; + from = [ + "virtualisation" + "digitialOceanImage" + "diskSize" + ]; + to = [ + "virtualisation" + "diskSize" + ]; + }) + ]; options = { - virtualisation.digitalOceanImage.diskSize = mkOption { - type = with types; either (enum [ "auto" ]) int; - default = "auto"; - example = 4096; - description = '' - Size of disk image. Unit is MB. - ''; - }; - virtualisation.digitalOceanImage.configFile = mkOption { type = with types; nullOr path; default = null; @@ -52,7 +59,6 @@ in #### implementation config = { - system.build.digitalOceanImage = import ../../lib/make-disk-image.nix { name = "digital-ocean-image"; format = "qcow2"; @@ -73,7 +79,7 @@ in config.virtualisation.digitalOcean.defaultConfigFile else cfg.configFile; - inherit (cfg) diskSize; + inherit (config.virtualisation) diskSize; inherit config lib pkgs; };