nixcfg/hosts/focalor/vfio.nix

43 lines
878 B
Nix
Executable file

{ config, lib, system, pkgs, modulesPath, inputs, ... }:
{
programs.virt-manager.enable = true;
virtualisation.spiceUSBRedirection.enable = true;
virtualisation.libvirtd = {
enable = true;
qemu = {
package = pkgs.qemu_kvm;
runAsRoot = true;
swtpm.enable = true;
ovmf = {
enable = true;
packages = [(pkgs.OVMF.override {
secureBoot = true;
tpmSupport = true;
}).fd];
};
};
hooks.qemu = {
win11 = ./scripts/vm-win11-hook.sh;
};
};
systemd.services.libvirtd = {
path = let
env = pkgs.buildEnv {
name = "qemu-hook-env";
paths = with pkgs; [
bash
libvirt
kmod
systemd
ripgrep
sd
];
};
in
[ env ];
};
users.extraUsers.regent.extraGroups = [ "libvirtd" ];
}