Files
my_nixos/hosts/generic/virtualization.nix
2026-05-09 16:17:24 +03:00

39 lines
1.2 KiB
Nix

{ pkgs, config, lib, ... }:
{
environment = {
systemPackages = [ pkgs.qemu pkgs.virt-manager ];
};
systemd.tmpfiles.rules = [ "L+ /var/lib/qemu/firmware - - - - ${pkgs.qemu}/share/qemu/firmware" ];
boot.binfmt.emulatedSystems = [
"aarch64-linux"
"riscv64-linux"
];
virtualisation.libvirtd = {
enable = true;
qemu = {
package = pkgs.qemu_kvm;
runAsRoot = true;
swtpm.enable = true;
};
};
virtualisation.containers.enable = true;
virtualisation = {
podman = {
enable = true;
# Create a `docker` alias for podman, to use it as a drop-in replacement
dockerCompat = true;
# Required for containers under podman-compose to be able to talk to each other.
defaultNetwork.settings.dns_enabled = true;
};
incus = {
enable = true;
ui.enable = true;
};
};
networking.firewall.interfaces.incusbr0.allowedTCPPorts = [ 53 67 ];
networking.firewall.interfaces.incusbr0.allowedUDPPorts = [ 53 67 ];
networking.firewall.interfaces.virbr0.allowedTCPPorts = [ 53 67 ];
networking.firewall.interfaces.virbr0.allowedUDPPorts = [ 53 67 ];
}