From c88c3f87e03c0c9d4e512f0fed3af30fbb8dc5bd Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Sun, 18 Feb 2024 22:13:32 +0100 Subject: [PATCH] buskerud: add libvirtd --- hosts/buskerud/configuration.nix | 2 ++ hosts/buskerud/services/libvirt.nix | 10 ++++++++++ users/felixalb.nix | 8 ++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 hosts/buskerud/services/libvirt.nix diff --git a/hosts/buskerud/configuration.nix b/hosts/buskerud/configuration.nix index 14eec65..1b4b461 100644 --- a/hosts/buskerud/configuration.nix +++ b/hosts/buskerud/configuration.nix @@ -4,6 +4,8 @@ ./hardware-configuration.nix ../../base.nix ../../misc/metrics-exporters.nix + + ./services/libvirt.nix ]; # buskerud does not support efi? diff --git a/hosts/buskerud/services/libvirt.nix b/hosts/buskerud/services/libvirt.nix new file mode 100644 index 0000000..01eae00 --- /dev/null +++ b/hosts/buskerud/services/libvirt.nix @@ -0,0 +1,10 @@ +{ config, pkgs, lib, ... }: +{ + virtualisation.libvirtd.enable = true; + programs.dconf.enable = true; + boot.kernelModules = [ "kvm-intel" ]; + + # On a gui-enabled machine, connect with: + # $ virt-manager --connect "qemu+ssh://buskerud/system?socket=/var/run/libvirt/libvirt-sock" +} + diff --git a/users/felixalb.nix b/users/felixalb.nix index fb496d2..5db6842 100644 --- a/users/felixalb.nix +++ b/users/felixalb.nix @@ -1,8 +1,12 @@ -{ pkgs, ... }: +{ pkgs, lib, config, ... }: { users.users.felixalb = { isNormalUser = true; - extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + extraGroups = [ + "wheel" + ] ++ lib.optionals ( config.users.groups ? "libvirtd" ) [ + "libvirtd" + ]; shell = pkgs.zsh; openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDKzPICGew7uN0cmvRmbwkwTCodTBUgEhkoftQnZuO4Q felixalbrigtsen@gmail.com"