clan-core/clanModules/zt-tcp-relay/default.nix

32 lines
710 B
Nix
Raw Normal View History

2024-03-17 18:48:49 +00:00
{
pkgs,
lib,
config,
...
}:
{
2024-01-12 13:25:31 +00:00
options.clan.zt-tcp-relay = {
port = lib.mkOption {
type = lib.types.port;
default = 4443;
description = "Port to listen on";
};
};
config = {
networking.firewall.allowedTCPPorts = [ config.clan.zt-tcp-relay.port ];
systemd.services.zt-tcp-relay = {
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
2024-03-17 18:48:49 +00:00
ExecStart = "${
2024-05-02 14:59:17 +00:00
pkgs.callPackage ../../pkgs/zt-tcp-relay { }
2024-03-17 18:48:49 +00:00
}/bin/zt-tcp-relay --listen [::]:${builtins.toString config.clan.zt-tcp-relay.port}";
2024-01-12 13:25:31 +00:00
Restart = "always";
RestartSec = "5";
dynamicUsers = true;
};
};
};
}