Skip to content

Commit 79c0c8c

Browse files
baloonRatio: reexpose it from the vm definition
This is to allow downstream to override it as it necessary for their use cases. Currently it is fixed and immutable from outside. Signed-off-by: Brian McGillion <bmg.avoin@gmail.com>
1 parent 35cb7d2 commit 79c0c8c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

modules/microvm/vm-config.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,16 @@ let
9797
description = "App VM vCPU count.";
9898
};
9999

100+
balloonRatio = mkOption {
101+
type = types.nullOr types.int;
102+
default = null;
103+
description = ''
104+
Memory balloon ratio. The VM is allocated ramMb * (balloonRatio + 1)
105+
bytes of memory, with ballooning enabled when balloonRatio > 0.
106+
If null, uses the default from the VM definition (typically 2).
107+
'';
108+
};
109+
100110
extraModules = mkOption {
101111
type = types.listOf types.unspecified;
102112
default = [ ];

modules/profiles/laptop-x86.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ in
218218
effectiveDef =
219219
vmDef
220220
// lib.optionalAttrs ((vmCfg.ramMb or null) != null) { inherit (vmCfg) ramMb; }
221-
// lib.optionalAttrs ((vmCfg.cores or null) != null) { inherit (vmCfg) cores; };
221+
// lib.optionalAttrs ((vmCfg.cores or null) != null) { inherit (vmCfg) cores; }
222+
// lib.optionalAttrs ((vmCfg.balloonRatio or null) != null) { inherit (vmCfg) balloonRatio; };
222223
in
223224
lib.nixosSystem {
224225
modules = [

0 commit comments

Comments
 (0)