{ config, lib, pkgs, username, ... }: with lib; let cfg = config.modules.gnomeBoxes; in { config = mkIf cfg.enable { virtualisation = { libvirtd = { enable = true; # Enable TPM emulation (for Windows 11) qemu = { package = pkgs.qemu_kvm; swtpm.enable = true; }; }; # Enable USD redirection spiceUSBRedirection.enable = true; }; # Allow VM management users.groups.libvirtd.members = [ username ]; users.groups.kvm.members = [ username ]; # Enable VM networking and file sharing environment.systemPackages = with pkgs; [ gnome-boxes swtpm dnsmasq phodav ]; }; }