diff --git a/devices/srv3/default.nix b/devices/srv3/default.nix index 4103524f..ca3ae1be 100644 --- a/devices/srv3/default.nix +++ b/devices/srv3/default.nix @@ -36,13 +36,13 @@ inputs: { alikia = { - memoryMB = 1024; + memory.sizeMB = 1024; cpus = 1; network = { address = 2; portForward.tcp = [{ host = 5689; guest = 22; }]; }; }; pen = { - memoryMB = 512; + memory.sizeMB = 512; cpus = 1; network = { @@ -64,7 +64,7 @@ inputs: test = { owner = "chn"; - memoryMB = 512; + memory.sizeMB = 512; cpus = 1; network = { @@ -75,7 +75,7 @@ inputs: }; reonokiy = { - memoryMB = 4 * 1024; + memory.sizeMB = 4 * 1024; cpus = 4; network = { address = 5; portForward.tcp = [{ host = 5694; guest = 22; }]; }; }; diff --git a/devices/test-pc/default.nix b/devices/test-pc/default.nix index 294e4246..42e07625 100644 --- a/devices/test-pc/default.nix +++ b/devices/test-pc/default.nix @@ -29,7 +29,7 @@ inputs: { chn = { - memoryMB = 2048; + memory.sizeMB = 2048; cpus = 4; network = { @@ -40,7 +40,8 @@ inputs: chn2 = { owner = "chn"; - memoryMB = 2048; cpus = 4; + memory.sizeMB = 2048; + cpus = 4; network = { address = 3; portForward.tcp = [{ host = 5694; guest = 22; }]; }; }; }; diff --git a/modules/services/nixvirt.nix b/modules/services/nixvirt.nix index 0f4ee788..c44940de 100644 --- a/modules/services/nixvirt.nix +++ b/modules/services/nixvirt.nix @@ -23,7 +23,11 @@ inputs: name = mkOption { type = types.nonEmptyStr; default = submoduleInputs.config._module.args.name; }; nodatacow = mkOption { type = types.bool; default = false; }; }; - memoryMB = mkOption { type = types.ints.unsigned; }; + memory = + { + sizeMB = mkOption { type = types.ints.unsigned; }; + dedicate = mkOption { type = types.bool; default = false; }; + }; cpus = mkOption { type = types.ints.unsigned; }; network = { @@ -140,7 +144,13 @@ inputs: inherit (vm.value) uuid; type = "kvm"; vcpu = { placement = "static"; count = vm.value.cpus; }; - memory = { count = vm.value.memoryMB; unit = "MiB"; }; + memory = + { + count = vm.value.memory.sizeMB; + unit = "MiB"; + nosharepages = vm.value.memory.dedicate; + locked = vm.value.memory.dedicate; + }; os = { type = "hvm";