zt-tcp-relay: add clan module + test
This commit is contained in:
parent
e1729a0991
commit
78cd5b3fec
|
@ -19,6 +19,7 @@
|
||||||
container = import ./container nixosTestArgs;
|
container = import ./container nixosTestArgs;
|
||||||
deltachat = import ./deltachat nixosTestArgs;
|
deltachat = import ./deltachat nixosTestArgs;
|
||||||
meshnamed = import ./meshnamed nixosTestArgs;
|
meshnamed = import ./meshnamed nixosTestArgs;
|
||||||
|
zt-tcp-relay = import ./zt-tcp-relay nixosTestArgs;
|
||||||
borgbackup = import ./borgbackup nixosTestArgs;
|
borgbackup = import ./borgbackup nixosTestArgs;
|
||||||
syncthing = import ./syncthing nixosTestArgs;
|
syncthing = import ./syncthing nixosTestArgs;
|
||||||
wayland-proxy-virtwl = import ./wayland-proxy-virtwl nixosTestArgs;
|
wayland-proxy-virtwl = import ./wayland-proxy-virtwl nixosTestArgs;
|
||||||
|
|
20
checks/zt-tcp-relay/default.nix
Normal file
20
checks/zt-tcp-relay/default.nix
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
(import ../lib/container-test.nix) ({ pkgs, ... }: {
|
||||||
|
name = "zt-tcp-relay";
|
||||||
|
|
||||||
|
nodes.machine = { self, ... }: {
|
||||||
|
imports = [
|
||||||
|
self.nixosModules.clanCore
|
||||||
|
self.clanModules.zt-tcp-relay
|
||||||
|
{
|
||||||
|
clanCore.machineName = "machine";
|
||||||
|
clanCore.clanDir = ./.;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
testScript = ''
|
||||||
|
start_all()
|
||||||
|
machine.wait_for_unit("zt-tcp-relay.service")
|
||||||
|
out = machine.succeed("${pkgs.netcat}/bin/nc -z -v localhost 4443")
|
||||||
|
print(out)
|
||||||
|
'';
|
||||||
|
})
|
|
@ -10,5 +10,6 @@
|
||||||
xfce = ./xfce.nix;
|
xfce = ./xfce.nix;
|
||||||
borgbackup = ./borgbackup.nix;
|
borgbackup = ./borgbackup.nix;
|
||||||
syncthing = ./syncthing.nix;
|
syncthing = ./syncthing.nix;
|
||||||
|
zt-tcp-relay = ./zt-tcp-relay.nix;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
23
clanModules/zt-tcp-relay.nix
Normal file
23
clanModules/zt-tcp-relay.nix
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{ pkgs, lib, config, ... }: {
|
||||||
|
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 = {
|
||||||
|
ExecStart = "${pkgs.callPackage ../pkgs/zt-tcp-relay {}}/bin/zt-tcp-relay --listen [::]:${builtins.toString config.clan.zt-tcp-relay.port}";
|
||||||
|
Restart = "always";
|
||||||
|
RestartSec = "5";
|
||||||
|
dynamicUsers = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user