{ 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"; }; }; }