NixOS-Config/modules/system/services/general/libvirtd/default.nix

58 lines
1.3 KiB
Nix
Raw Permalink Normal View History

{ config, lib, pkgs, ... }:
{
options.system.libvirtd = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable libvirtd and such";
};
};
config = lib.mkIf config.system.libvirtd.enable {
virtualisation = {
libvirtd = {
enable = true;
onBoot = "ignore";
onShutdown = "shutdown";
qemu = {
ovmf = {
enable = true;
packages = [
pkgs.OVMFFull.fd
pkgs.pkgsCross.aarch64-multiplatform.OVMF.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"
];
systemd.tmpfiles.rules = [ "f /dev/shm/looking-glass 0660 jimbo libvirtd -" ];
};
}