main
1{ lib, pkgs, ... }:
2{
3 system.nixos.tags = [ "libvirt" ];
4 boot.kernelParams = [ "kvm_intel.nested=1" ];
5 environment.etc."modprobe.d/kvm.conf".text = ''
6 options kvm_intel nested=1
7 '';
8 virtualisation.libvirtd = {
9 enable = true;
10 allowedBridges = [ "br1" ]; # Could be different dependinng on the host ?
11 firewallBackend = "nftables";
12 extraConfig = ''
13 listen_tls = 0
14 listen_tcp = 1
15 auth_tcp="none"
16 tcp_port = "16509"
17 '';
18 # extraOptions = [ "--listen" ];
19 };
20 networking.firewall.allowedTCPPorts = [ 16509 ];
21 security.polkit.enable = true; # 22.11: libvirtd requires poltkit to be enabled
22 environment.systemPackages = with pkgs; [
23 qemu
24 vde2
25 libosinfo
26 ];
27 boot.kernel.sysctl = {
28 "net.ipv4.ip_forward" = lib.mkDefault 1;
29 };
30}