From 80712f254c211ef53c05b154a0d9196548138b2a Mon Sep 17 00:00:00 2001 From: Sirio Balmelli Date: Fri, 21 Jun 2024 08:53:00 +0200 Subject: [PATCH] nixos/oci-image: expose diskSize as a configurable option diskSize defaults to the previous hard-coded 8192: no change for existing users. Users can set diskSize when building images which require larger disk space; thus avoiding the error: ERROR: cptofs failed. diskSize might be too small for closure. Signed-off-by: Sirio Balmelli Co-authored-by: superherointj <5861043+superherointj@users.noreply.github.com> --- nixos/modules/virtualisation/oci-image.nix | 2 +- nixos/modules/virtualisation/oci-options.nix | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/nixos/modules/virtualisation/oci-image.nix b/nixos/modules/virtualisation/oci-image.nix index d4af5016dd71..1e2b90bfd46e 100644 --- a/nixos/modules/virtualisation/oci-image.nix +++ b/nixos/modules/virtualisation/oci-image.nix @@ -9,10 +9,10 @@ in config = { system.build.OCIImage = import ../../lib/make-disk-image.nix { inherit config lib pkgs; + inherit (cfg) diskSize; name = "oci-image"; configFile = ./oci-config-user.nix; format = "qcow2"; - diskSize = 8192; partitionTableType = if cfg.efi then "efi" else "legacy"; }; diff --git a/nixos/modules/virtualisation/oci-options.nix b/nixos/modules/virtualisation/oci-options.nix index 0dfedc6a530c..76f3475a4281 100644 --- a/nixos/modules/virtualisation/oci-options.nix +++ b/nixos/modules/virtualisation/oci-options.nix @@ -9,6 +9,12 @@ Whether the OCI instance is using EFI. ''; }; + diskSize = lib.mkOption { + type = lib.types.int; + default = 8192; + description = "Size of the disk image created in MB."; + example = "diskSize = 12 * 1024; # 12GiB"; + }; }; }; }