make natpmp module thing work

This commit is contained in:
xunuwu 2025-10-22 09:26:14 +02:00
parent c6df96cfea
commit d84d25bf0c
Signed by: xun
SSH key fingerprint: SHA256:Uot/1WoAjWAeqLOHA5vYy4phhVydsH7jCPmBjaPZfgI
3 changed files with 31 additions and 37 deletions

View file

@ -14,7 +14,6 @@
./profiles/wireguard.nix
./profiles/restic-server.nix
./profiles/autologin.nix
./profiles/ssh-public-port-2050.nix
inputs.impermanence.nixosModules.impermanence
inputs.stylix.nixosModules.stylix
@ -110,6 +109,16 @@
'')
];
own.natpmp-portforward = {
enable = true;
mappings = [
{
public = 2050;
local = 22;
}
];
};
nixpkgs.config = {
# rocmSupport = true;
allowUnfreePredicate = pkg:

View file

@ -1,17 +0,0 @@
{pkgs, ...}: {
systemd.services.ssh-port2050-natpmp = {
bindsTo = ["sshd.socket"];
after = ["sshd.socket"];
wantedBy = ["multi-user.target"];
serviceConfig.Restart = "on-failure";
serviceConfig.ExecStart = pkgs.writeScript "ssh-port2050-natpmp" ''
#!${pkgs.bash}/bin/bash
while true
do
${pkgs.libnatpmp}/bin/natpmpc -a 2050 22 tcp 60
${pkgs.coreutils}/bin/sleep 30
done
'';
};
}