From 627f3257e493c8b65ea24614598baf2bcc20bba5 Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Mon, 12 Feb 2024 16:41:28 +0100 Subject: [PATCH] add virt-manager --- modules/boxes.nix | 2 ++ modules/virt-manager.nix | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 modules/virt-manager.nix diff --git a/modules/boxes.nix b/modules/boxes.nix index 7d7efdf..77e43e6 100644 --- a/modules/boxes.nix +++ b/modules/boxes.nix @@ -1,5 +1,7 @@ { config, pkgs, ... }: { + # See also: virt-manager.nix + # View log since last boot: # journalctl -b SYSLOG_IDENTIFIER=org.gnome.Boxes diff --git a/modules/virt-manager.nix b/modules/virt-manager.nix new file mode 100644 index 0000000..04720ea --- /dev/null +++ b/modules/virt-manager.nix @@ -0,0 +1,29 @@ +{ config, pkgs, ... }: +{ + # See also: boxes.nix + + # libvirt is a dependency of Virt-manager + # https://nixos.wiki/wiki/Libvirt + virtualisation.libvirtd.enable = true; + users.users.yoda.extraGroups = [ "libvirtd" ]; + + # Required for USB redirection to work with GNOME boxes. Maybe this is also required for virt-Manager? + # See + # https://github.com/NixOS/nixpkgs/issues/39129#issuecomment-382569032 + # https://www.reddit.com/r/NixOS/comments/177wcyi/comment/k4vok4n/ + security.polkit.enable = true; + virtualisation.spiceUSBRedirection.enable = true; + + # https://nixos.wiki/wiki/Virt-manager + # TODO: nixpkgs virtio-win + programs.virt-manager.enable = true; + programs.dconf.enable = true; + home-manager.users.yoda = { osConfig, config, pkgs, ... }: { + dconf.settings = { + "org/virt-manager/virt-manager/connections" = { + autoconnect = ["qemu:///system"]; + uris = ["qemu:///system"]; + }; + }; + }; +}