nix/nixos/hosts/framework-server/containers.nix
2024-03-26 11:35:38 +09:00

20 lines
662 B
Nix

{ config, lib, self, inputs, outputs, stateVersion, hmStateVersion, ... }:
let
libx = import ../../../lib { inherit lib self inputs outputs stateVersion hmStateVersion; };
lanInterface = "enp0s13f0u4";
in {
containers = {
rdesktop = libx.mkContainer { hostname = "rdesktop"; };
};
networking.firewall.extraCommands = ''
iptables -w -t nat -A nixos-nat-post -s ${config.containers.rdesktop.localAddress} -j MASQUERADE
'';
networking.nat = {
enable = true;
internalInterfaces = [ "ve-rdesktop" ];
externalInterface = lanInterface;
extraCommands = "iptables -t nat -A POSTROUTING -o ${lanInterface} -j MASQUERADE";
};
}