diff --git a/nixos/boxes/bolty/bolty-boot.nix b/nixos/boxes/bolty/bolty-boot.nix index 78046fdd..bf4dad5c 100644 --- a/nixos/boxes/bolty/bolty-boot.nix +++ b/nixos/boxes/bolty/bolty-boot.nix @@ -1,14 +1,11 @@ -{ - config, - pkgs, - ... -}: { +{ config, pkgs, ... }: { boot = { kernelPackages = pkgs.linuxPackages_latest; - initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sdhci_acpi"]; - initrd.kernelModules = ["dm-snapshot"]; - kernelModules = ["kvm-amd"]; - extraModulePackages = []; + initrd.availableKernelModules = + [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sdhci_acpi" ]; + initrd.kernelModules = [ "dm-snapshot" ]; + kernelModules = [ "kvm-amd" ]; + extraModulePackages = [ ]; loader.systemd-boot.enable = true; loader.efi.canTouchEfiVariables = false; }; @@ -37,7 +34,7 @@ fsType = "vfat"; }; - swapDevices = []; + swapDevices = [ ]; nix.settings = { max-jobs = 8; @@ -47,6 +44,6 @@ zramSwap = { enable = true; algorithm = "zstd"; - memoryPercent = 50; + memoryPercent = 100; }; } diff --git a/nixos/boxes/bolty/default.nix b/nixos/boxes/bolty/default.nix index 87df61d3..d0bf6b5a 100644 --- a/nixos/boxes/bolty/default.nix +++ b/nixos/boxes/bolty/default.nix @@ -13,28 +13,12 @@ ./restic-server.nix ./tailscale-cert.nix ./woodpecker-agent.nix + ./virtualisation.nix ]; boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; programs.ccache.enable = true; networking.hostName = "bolty"; - boot.kernelModules = [ "kvm_amd" ]; - virtualisation = { - libvirtd = { - enable = true; - qemu.ovmf.enable = true; - }; - }; - environment.systemPackages = with pkgs; [ - qemu - virt-manager - usbutils - virt-viewer - lm_sensors - ]; - networking.firewall.allowedTCPPorts = [ 5900 ]; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; - security.allowUserNamespaces = true; - time.timeZone = "Europe/London"; } diff --git a/nixos/boxes/bolty/home-assistant.nix b/nixos/boxes/bolty/home-assistant.nix index 64eb873b..62831e76 100644 --- a/nixos/boxes/bolty/home-assistant.nix +++ b/nixos/boxes/bolty/home-assistant.nix @@ -1,13 +1,8 @@ -{ - config, - pkgs, - inputs, - lib, - ... -}: let - port = 8123; +{ config, pkgs, inputs, lib, ... }: +let port = 8123; in { - imports = []; + imports = [ ./virtualisation.nix ]; + + networking.firewall.allowedTCPPorts = [ port ]; - networking.firewall.allowedTCPPorts = [port]; } diff --git a/nixos/boxes/bolty/virtualisation.nix b/nixos/boxes/bolty/virtualisation.nix new file mode 100644 index 00000000..3cb4c791 --- /dev/null +++ b/nixos/boxes/bolty/virtualisation.nix @@ -0,0 +1,21 @@ +{ config, pkgs, inputs, lib, ... }: { + boot.kernelModules = [ "kvm_amd" ]; + virtualisation = { + libvirtd = { + enable = true; + qemu.ovmf.enable = true; + allowedBridges = [ "br0" ]; + }; + }; + environment.systemPackages = with pkgs; [ + qemu + virt-manager + usbutils + virt-viewer + lm_sensors + ]; + networking.firewall.allowedTCPPorts = [ 5900 ]; + + security.allowUserNamespaces = true; + +}