0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 13:40:28 +03:00

digital-ocean-image: use virtualisation.diskSize

This makes negative diskSizes, that were previously allowed illegal.
This commit is contained in:
phaer 2024-09-05 13:06:39 +02:00
parent d37a3ea1ef
commit d223461d54

View file

@ -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;
};