From a2a5df1e632a247f44f64c7acf79e41a6327e270 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 24 Jul 2021 09:33:10 +0200 Subject: [PATCH 1/2] vbox-image: add new option to set free space in image (cherry picked from commit a6700d75f38cda83367a8af84651a2a72ce0f3ef) --- nixos/modules/virtualisation/virtualbox-image.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nixos/modules/virtualisation/virtualbox-image.nix b/nixos/modules/virtualisation/virtualbox-image.nix index 071edda8269..d31921f95ea 100644 --- a/nixos/modules/virtualisation/virtualbox-image.nix +++ b/nixos/modules/virtualisation/virtualbox-image.nix @@ -18,6 +18,13 @@ in { The size of the VirtualBox base image in MiB. ''; }; + baseImageFreeSpace = mkOption { + type = with types; int; + default = 30 * 1024; + description = '' + Free space in the VirtualBox base image in MiB. + ''; + }; memorySize = mkOption { type = types.int; default = 1536; @@ -117,6 +124,7 @@ in { inherit pkgs lib config; partitionTableType = "legacy"; diskSize = cfg.baseImageSize; + additionalSpace = cfg.baseImageFreeSpace; postVM = '' From 2194711ae07e7bf51d7937fa2bd1a6ea0d292c1a Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sun, 1 Aug 2021 18:59:08 +0000 Subject: [PATCH 2/2] nixos/virtualbox-image: cast baseImageFreeSpace into str This fixes an evaluation error that's blocking the nixos-unstable channel (#132328). (cherry picked from commit b5fab53628e8f080bae24ea1396f72d9d21e1f9b) --- nixos/modules/virtualisation/virtualbox-image.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/virtualisation/virtualbox-image.nix b/nixos/modules/virtualisation/virtualbox-image.nix index d31921f95ea..cd356b9d382 100644 --- a/nixos/modules/virtualisation/virtualbox-image.nix +++ b/nixos/modules/virtualisation/virtualbox-image.nix @@ -124,7 +124,7 @@ in { inherit pkgs lib config; partitionTableType = "legacy"; diskSize = cfg.baseImageSize; - additionalSpace = cfg.baseImageFreeSpace; + additionalSpace = "${toString cfg.baseImageFreeSpace}M"; postVM = ''