diff --git a/modules/misc/virt-manager.nix b/modules/misc/virt-manager.nix index c04a222..5cf8bb4 100644 --- a/modules/misc/virt-manager.nix +++ b/modules/misc/virt-manager.nix @@ -1,52 +1,45 @@ -{lib, config, pkgs, ... }: +{ lib, config, pkgs, ... }: with lib; -let - cfg = config.custom.virt-manager; -in -{ +let cfg = config.custom.virt-manager; +in { options.custom.virt-manager = { enable = mkEnableOption "Enables virt-manager"; }; - + config = mkIf cfg.enable { - programs.dconf.enable = true; # virt-manager requires dconf to remember settings - environment.systemPackages = with pkgs; [ virt-manager virtiofsd ]; + programs.dconf.enable = + true; # virt-manager requires dconf to remember settings + environment.systemPackages = with pkgs; [ virtiofsd ]; environment.sessionVariables.GSETTINGS_BACKEND = "keyfile"; boot.extraModprobeConfig = '' options kvm ignore_msrs=1 ''; - + + programs.virt-manager.enable = true; virtualisation = { libvirtd = { enable = true; qemu = { #package = pkgs.qemu_kvm; - runAsRoot = true; swtpm.enable = true; ovmf.enable = true; ovmf.packages = [ pkgs.OVMFFull.fd ]; }; hooks.qemu = { - # doesnt work, screen just freezes. no error in libvirt logs though, so idk how to fix it - "passthrough" = lib.getExe ( - pkgs.writeShellApplication { + # doesnt work, screen just freezes. no error in libvirt logs though, so idk how to fix it + "passthrough" = lib.getExe (pkgs.writeShellApplication { name = "qemu-hook"; excludeShellChecks = [ "SC2046" "SC2086" ]; - runtimeInputs = with pkgs; [ - libvirt - systemd - kmod - ]; + runtimeInputs = with pkgs; [ libvirt systemd kmod ]; text = builtins.readFile ./hook.sh; - } - ); + }); }; }; spiceUSBRedirection.enable = true; }; - services.spice-vdagentd.enable = true; - users.users.${config.mainUser.name}.extraGroups = [ "libvirtd" "kvm" "input" ]; + services.spice-vdagentd.enable = true; + users.users.${config.mainUser.name}.extraGroups = + [ "libvirtd" "kvm" "input" ]; }; } - diff --git a/systems/amd-server/configuration.nix b/systems/amd-server/configuration.nix index f296775..a792278 100644 --- a/systems/amd-server/configuration.nix +++ b/systems/amd-server/configuration.nix @@ -15,6 +15,7 @@ tmpfs.enable = true; nftables.enable = true; cli-tools.enable = true; + virt-manager.enable = true; nix = { index.enable = true; ld.enable = true; @@ -39,7 +40,6 @@ # enable = true; # server = [ "192.168.0.10" ]; #}; - misc = { docker.enable = true; }; services = { syncthing = { enable = true; }; }; hardware = { firmware.enable = true;