summaryrefslogtreecommitdiffstats
path: root/lass/2configs/libvirt.nix
blob: e739d2f7942c6eaba5ae1814a6673979e4c543d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{ config, lib, pkgs, ... }:

let
  mainUser = config.users.extraUsers.mainUser;
  inherit (import <stockholm/lib>) genid;

in {
  virtualisation.libvirtd.enable = true;

  users.extraUsers = {
    libvirt = {
      uid = genid "libvirt";
      description = "user for running libvirt stuff";
      home = "/home/libvirt";
      useDefaultShell = true;
      extraGroups = [ "libvirtd" "audio" ];
      createHome = true;
    };
  };
  security.sudo.extraConfig = ''
    ${mainUser.name} ALL=(libvirt) NOPASSWD: ALL
  '';
}