From 5cb292704562ab76c9a9844e37489257b299ecfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20R=C3=B6ger?= Date: Wed, 2 Apr 2025 23:14:18 +0200 Subject: [PATCH] System Gen157 @ 2025-04-02-23:14:18 --- hosts/comfy-station/configuration.nix | 4 ++++ modules/services/virt-manager.nix | 33 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 modules/services/virt-manager.nix diff --git a/hosts/comfy-station/configuration.nix b/hosts/comfy-station/configuration.nix index 3ccce96..1cf16c0 100644 --- a/hosts/comfy-station/configuration.nix +++ b/hosts/comfy-station/configuration.nix @@ -19,11 +19,15 @@ ../../modules/hardware/sound.nix ../../modules/hardware/yubikey.nix ../../modules/programs.nix + ../../modules/services/virt-manager.nix ]; desktop.dm.name = "sddm"; desktop.de.plasma.enable = false; desktop.de.hyprland.enable = true; + services.virt-manager.enable = true; + services.virt-manager.forUsers = ["jonas"]; + nix = { settings = { experimental-features = ["nix-command" "flakes"]; diff --git a/modules/services/virt-manager.nix b/modules/services/virt-manager.nix new file mode 100644 index 0000000..631c994 --- /dev/null +++ b/modules/services/virt-manager.nix @@ -0,0 +1,33 @@ +{ + lib, + config, + ... +}: let + cfg = config.services.virt-manager; +in { + options = { + services.virt-manager = { + enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Enable the qemu-kvm + libvirt stack. + ''; + }; + forUsers = lib.mkOption { + type = lib.types.listOf lib.types.string; + default = []; + description = '' + List of users that should be added to the libvirt group. + ''; + }; + }; + }; + + config = lib.mkIf cfg.enable { + programs.virt-manager.enable = true; + users.groups.libvirtd.members = cfg.forUsers; + virtualisation.libvirtd.enable = true; + virtualisation.spiceUSBRedirection.enable = true; + }; +}