2024-12-07 22:53:20 +01:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
2024-12-14 21:58:45 +01:00
|
|
|
pkgs,
|
2024-12-07 22:53:20 +01:00
|
|
|
...
|
|
|
|
}:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
mkIf (elem "virt-manager" config.machine.services) {
|
|
|
|
virtualisation.libvirtd.enable = true;
|
|
|
|
programs.virt-manager.enable = true;
|
|
|
|
dconf.settings = {
|
|
|
|
"org/virt-manager/virt-manager/connections" = {
|
|
|
|
autoconnect = [ "qemu:///system" ];
|
|
|
|
uris = [ "qemu:///system" ];
|
|
|
|
};
|
|
|
|
};
|
2024-12-14 21:58:45 +01:00
|
|
|
|
|
|
|
services.nfs.server.enable = true;
|
|
|
|
|
|
|
|
# rule for vagrant virtualbox provider.
|
|
|
|
networking.firewall.extraCommands = lib.optionalString (config.virtualisation.virtualbox.host.enable) ''
|
|
|
|
ip46tables -I INPUT 1 -i vboxnet+ -p tcp -m tcp --dport 2049 -j ACCEPT
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Add firewall exception for libvirt provider when using NFSv4
|
|
|
|
networking.firewall.interfaces."virbr1" = {
|
|
|
|
allowedTCPPorts = [ 2049 ];
|
|
|
|
allowedUDPPorts = [ 2049 ];
|
|
|
|
};
|
|
|
|
|
|
|
|
environment = {
|
|
|
|
systemPackages = with pkgs; [
|
|
|
|
vagrant
|
|
|
|
];
|
|
|
|
variables.VAGRANT_DEFAULT_PROVIDER = "libvirt";
|
|
|
|
};
|
2024-12-07 22:53:20 +01:00
|
|
|
}
|