From 7a417e7260fa63b23320a2b1d5554630b1e0aeed Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Sat, 23 Mar 2024 15:53:21 +0530 Subject: [PATCH] enable virt-manager --- common/users/default.nix | 2 +- home/programs/default.nix | 1 + home/programs/virt-manager.nix | 18 ++++++++++++++++++ home/wm/hyprland/default.nix | 4 ++++ hosts/skipper/persistence.nix | 1 + hosts/skipper/virtualisation.nix | 11 +++++++++++ 6 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 home/programs/virt-manager.nix diff --git a/common/users/default.nix b/common/users/default.nix index 1b05108..069991f 100644 --- a/common/users/default.nix +++ b/common/users/default.nix @@ -16,7 +16,7 @@ in inherit (users.primary) hashedPassword; description = users.primary.realName; isNormalUser = true; - extraGroups = [ "docker" "networkmanager" "tss" "wheel" ]; + extraGroups = [ "docker" "libvirtd" "networkmanager" "tss" "wheel" ]; shell = pkgs.zsh; openssh.authorizedKeys.keys = [ users.primary.sshPublicKey diff --git a/home/programs/default.nix b/home/programs/default.nix index 68afc25..8ed11be 100644 --- a/home/programs/default.nix +++ b/home/programs/default.nix @@ -15,6 +15,7 @@ ./ssh.nix ./starship.nix ./tmux.nix + ./virt-manager.nix ./yt-dlp.nix ./zsh.nix ]; diff --git a/home/programs/virt-manager.nix b/home/programs/virt-manager.nix new file mode 100644 index 0000000..a235947 --- /dev/null +++ b/home/programs/virt-manager.nix @@ -0,0 +1,18 @@ +{ pkgs, ... }: { + home.packages = [ pkgs.virt-manager ]; + dconf.settings = { + "org/virt-manager/virt-manager/confirm" = { + forcepoweroff = false; + }; + "org/virt-manager/virt-manager/connections" = { + autoconnect = [ "qemu:///system" ]; + uris = [ "qemu:///system" ]; + }; + "org/virt-manager/virt-manager/new-vm" = { firmware = "uefi"; }; + "org/virt-manager/virt-manager/stats" = { + enable-disk-poll = true; + enable-net-poll = true; + }; + "org/virt-manager/virt-manager/vmlist-fields" = { network-traffic = true; }; + }; +} diff --git a/home/wm/hyprland/default.nix b/home/wm/hyprland/default.nix index 206eedf..ac602c0 100644 --- a/home/wm/hyprland/default.nix +++ b/home/wm/hyprland/default.nix @@ -130,6 +130,10 @@ in "size 60% 60%,class:lutris" "dimaround,class:^(gcr-prompter)$" + + "float,class:^(virt-manager)$" + "size 25% 50%,class:^(virt-manager)$,title:^(Virtual Machine Manager)$" + "move 5%% 10%,class:^(virt-manager)$,title:^(Virtual Machine Manager)$" ]; exec-once = [ diff --git a/hosts/skipper/persistence.nix b/hosts/skipper/persistence.nix index 00a58fd..08c69d3 100644 --- a/hosts/skipper/persistence.nix +++ b/hosts/skipper/persistence.nix @@ -12,6 +12,7 @@ _: { "/var/lib/docker" "/var/lib/fwupd" "/var/lib/iwd" + "/var/lib/libvirt" "/var/lib/machines" "/var/lib/NetworkManager" "/var/lib/nixos" diff --git a/hosts/skipper/virtualisation.nix b/hosts/skipper/virtualisation.nix index 4d1ba37..ac30c5f 100644 --- a/hosts/skipper/virtualisation.nix +++ b/hosts/skipper/virtualisation.nix @@ -5,5 +5,16 @@ enable = true; storageDriver = "btrfs"; }; + kvmgt.enable = true; + libvirtd = { + enable = true; + qemu = { + package = pkgs.qemu_kvm; + ovmf = { + enable = true; + packages = [ pkgs.OVMFFull.fd ]; + }; + }; + }; }; }