41 lines
770 B
Nix
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" ];
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|