{ config, pkgs, ... }: { boot.kernelParams = [ "amd_iommu=on" "pcie_aspm=off" ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModprobeConfig = "options kvm_amd nested=1"; # Enable dconf (System Management Tool) # programs.dconf.enable = true; # Add user to libvirtd group users.users.zulumann.extraGroups = [ "libvirtd" "kvm" ]; # Install necessary packages environment.systemPackages = with pkgs; [ libvirt qemu qemu_kvm OVMFFull virt-manager virt-viewer spice spice-gtk spice-protocol adwaita-icon-theme python3 iproute2 bridge-utils ]; # Manage the virtualisation services virtualisation = { libvirtd = { enable = true; qemu = { swtpm.enable = true; ovmf.enable = true; ovmf.packages = [ pkgs.OVMFFull.fd ]; }; }; spiceUSBRedirection.enable = true; }; # Enable VirtioFS virtualisation.libvirtd.qemu.vhostUserPackages = [ pkgs.virtiofsd ]; environment.sessionVariables.LIBVIRT_DEFAULT_URI = [ "qemu:///system" ]; services.spice-vdagentd.enable = true; # Enable Bridge-Network networking.firewall.checkReversePath = false; networking.interfaces.eth0.useDHCP = true; networking.interfaces.br-lan.useDHCP = true; networking.bridges = { "br-lan" = { interfaces = [ "eth0" ]; }; }; }