From e0ab5f5af3f7d4743366368c09abf668ee78538a Mon Sep 17 00:00:00 2001 From: "Casper V. Kristensen" Date: Wed, 13 Nov 2024 02:50:39 +0100 Subject: [PATCH] tor: enable hot-adding memory --- hosts/tor/hardware.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/hosts/tor/hardware.nix b/hosts/tor/hardware.nix index 0a546a1..c3be88e 100644 --- a/hosts/tor/hardware.nix +++ b/hosts/tor/hardware.nix @@ -9,7 +9,7 @@ (modulesPath + "/profiles/qemu-guest.nix") ]; - boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sr_mod" "virtio_blk"]; + boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod"]; boot.initrd.kernelModules = ["dm-snapshot"]; boot.kernelModules = []; boot.extraModulePackages = []; @@ -37,5 +37,17 @@ } ]; + # Enable hot-adding memory + # https://pve.proxmox.com/wiki/Hotplug_(qemu_disk,nic,cpu,memory) + # Nix code inspired by (this isn't hyperv): + # https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/virtualisation/hyperv-guest.nix + services.udev.packages = lib.singleton (pkgs.writeTextFile { + name = "proxmox-memory-hotadd-udev-rules"; + destination = "/etc/udev/rules.d/80-hotplug-mem.rules"; + text = '' + SUBSYSTEM=="memory", ACTION=="add", TEST=="state", ATTR{state}=="offline", ATTR{state}="online" + ''; + }); + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; }