mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
digital-ocean-image: use virtualisation.diskSize
This makes negative diskSizes, that were previously allowed illegal.
This commit is contained in:
parent
d37a3ea1ef
commit
d223461d54
1 changed files with 18 additions and 12 deletions
|
@ -8,21 +8,28 @@
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.virtualisation.digitalOceanImage;
|
cfg = config.virtualisation.digitalOceanImage;
|
||||||
|
virtualisationOptions = import ./virtualisation-options.nix;
|
||||||
in
|
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 = {
|
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 {
|
virtualisation.digitalOceanImage.configFile = mkOption {
|
||||||
type = with types; nullOr path;
|
type = with types; nullOr path;
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -52,7 +59,6 @@ in
|
||||||
|
|
||||||
#### implementation
|
#### implementation
|
||||||
config = {
|
config = {
|
||||||
|
|
||||||
system.build.digitalOceanImage = import ../../lib/make-disk-image.nix {
|
system.build.digitalOceanImage = import ../../lib/make-disk-image.nix {
|
||||||
name = "digital-ocean-image";
|
name = "digital-ocean-image";
|
||||||
format = "qcow2";
|
format = "qcow2";
|
||||||
|
@ -73,7 +79,7 @@ in
|
||||||
config.virtualisation.digitalOcean.defaultConfigFile
|
config.virtualisation.digitalOcean.defaultConfigFile
|
||||||
else
|
else
|
||||||
cfg.configFile;
|
cfg.configFile;
|
||||||
inherit (cfg) diskSize;
|
inherit (config.virtualisation) diskSize;
|
||||||
inherit config lib pkgs;
|
inherit config lib pkgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue