diff options
| author | Fuwn <[email protected]> | 2024-09-20 05:36:20 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-09-20 05:36:20 -0700 |
| commit | d9747c64b038943253eaafdc59a49d5face46dab (patch) | |
| tree | b452d15a7f20e9f4bb70ec9f9040137bec1072f8 /modules/core/virtualisation/qemu.nix | |
| parent | himeji: move containers over from seti (diff) | |
| download | nixos-config-d9747c64b038943253eaafdc59a49d5face46dab.tar.xz nixos-config-d9747c64b038943253eaafdc59a49d5face46dab.zip | |
modules: server and core modules
Diffstat (limited to 'modules/core/virtualisation/qemu.nix')
| -rw-r--r-- | modules/core/virtualisation/qemu.nix | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/modules/core/virtualisation/qemu.nix b/modules/core/virtualisation/qemu.nix new file mode 100644 index 0000000..849ead1 --- /dev/null +++ b/modules/core/virtualisation/qemu.nix @@ -0,0 +1,45 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + qemu_kvm + qemu + ]; + + hardware.pulseaudio.extraConfig = '' + load-module module-native-protocol-unix auth-group=qemu-libvirtd socket=/tmp/pulse-socket + ''; + + boot.kernelModules = [ "vfio-pci" ]; + + networking.firewall.trustedInterfaces = [ + "virbr0" + "br0" + ]; + + services.udev.extraRules = '' + SUBSYSTEM=="vfio", OWNER="root", GROUP="kvm" + ''; + + virtualisation.libvirtd.qemu = { + package = pkgs.qemu_kvm; + runAsRoot = true; + swtpm.enable = true; + + ovmf = { + enable = true; + + packages = [ + (pkgs.OVMFFull.override { + secureBoot = true; + tpmSupport = true; + }).fd + ]; + }; + + verbatimConfig = '' + namespaces = [] + + dynamic_ownership = 0 + ''; + }; +} |