nixos-config/modules/system/services/general/libvirtd/default.nix

49 lines
1.1 KiB
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
{
2025-02-02 13:42:37 -05:00
options.system.libvirtd.enable = lib.mkEnableOption "Enable libvirtd services";
config = lib.mkIf config.system.libvirtd.enable {
virtualisation = {
libvirtd = {
enable = true;
onBoot = "ignore";
onShutdown = "shutdown";
qemu = {
ovmf = {
enable = true;
2025-01-10 13:25:24 -05:00
packages = with pkgs; [ OVMFFull.fd ];
};
swtpm.enable = true;
};
};
};
2024-11-05 05:49:14 -05:00
environment = {
systemPackages = with pkgs; [
virt-manager
virtiofsd
dnsmasq
spice-vdagent
looking-glass-client
];
persistence."/persist".directories = [
"/var/lib/libvirt/dnsmasq"
"/var/lib/libvirt/nwfilter"
"/var/lib/libvirt/qemu"
"/var/lib/libvirt/secrets"
"/var/lib/libvirt/storage"
"/var/lib/libvirt/swtpm"
];
};
# Needed to make NAT work
networking.firewall.trustedInterfaces = [
"virbr0"
"virbr1"
];
2025-01-03 17:52:33 -05:00
systemd.tmpfiles.rules = [ "f /dev/shm/looking-glass 0660 ${config.sysusers.main} libvirtd -" ];
};
}