1 { pkgs, lib, config, credentials, host, ... }:
3 domain = "i.sourcephile.fr";
5 gateway = config.networking.defaultGateway.interface;
8 systemd.services.iodined.serviceConfig.LoadCredentialEncrypted = "password:${credentials}/iodine/password.secret";
9 systemd.sockets.iodined = {
11 listenDatagrams = [ "127.0.0.1:1053" ];
12 socketConfig.BindToDevice = "lo";
13 socketConfig.ReusePort = true;
14 wantedBy = [ "sockets.target" ];
16 services.iodine.server = {
19 passwordFile = "$CREDENTIALS_DIRECTORY/password";
21 extraConfig = "-4 -c -d ${iface} -n ${host.ipv4}";
23 boot.kernel.sysctl."net.ipv4.ip_forward" = 1;
24 networking.nftables.ruleset = ''
26 add rule inet filter forward iifname "${iface}" oifname "${gateway}" counter accept
27 add rule inet filter forward iifname "${gateway}" oifname "${iface}" counter accept
30 add rule inet nat postrouting iifname "${iface}" oifname "${gateway}" masquerade