Files
nixos-configs/hosts/pinwheel/modules/vm/default.nix
Alexander Heldt f15701f426 Apply nixfmt
2024-09-02 21:55:41 +02:00

41 lines
770 B
Nix

{
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.vm.enable;
in
{
options = {
mod.vm = {
enable = lib.mkEnableOption "add vm module";
};
};
config = lib.mkIf enabled {
virtualisation = {
spiceUSBRedirection.enable = true; # Allow redirecting USB to the VM
libvirtd.enable = true;
};
users.users.alex = {
extraGroups = [ "libvirtd" ];
};
# virt-manager requires dconf to remember settings
programs.dconf.enable = true;
programs.virt-manager.enable = true;
home-manager.users.alex = {
dconf.settings = {
"org/virt-manager/virt-manager/connections" = {
autoconnect = [ "qemu:///system" ];
uris = [ "qemu:///system" ];
};
};
};
};
}