nixos-configuration/modules/libvirt.nix
2023-06-22 12:03:23 +00:00

35 lines
828 B
Nix

{ config, lib, pkgs, ... }:
let
cfg = config.jalr;
in
{
options.jalr = {
libvirt = {
enable = pkgs.lib.mkEnableOption "Enable libvirt";
};
};
config = lib.mkIf cfg.libvirt.enable {
environment.systemPackages = with pkgs; lib.mkIf config.jalr.gui.enable [
spice-gtk
virt-manager
];
virtualisation = {
libvirtd = {
enable = true;
qemu.ovmf.enable = true;
# start: starts all guests that were running prior to shutdown
# ignore: only start guests which are marked as autostart
onBoot = "ignore";
onShutdown = "shutdown";
};
};
security.wrappers.spice-client-glib-usb-acl-helper = {
owner = "root";
group = "root";
source = "${pkgs.spice-gtk}/bin/spice-client-glib-usb-acl-helper";
};
};
}