nixos-config/machines/orbi/service-taskchampion.nix
2024-09-16 06:36:08 +07:00

42 lines
1.1 KiB
Nix

{
config,
lib,
pkgs,
zerotierInterface,
...
}:
{
verify.closed.public.ports.taskchampion = [ config.services.taskchampion-sync-server.port ];
verify.localCommands.taskchampion =
let
domain = "http://orbi.private:10222";
curl = lib.getExe pkgs.curl;
grep = lib.getExe pkgs.gnugrep;
grepString = "TaskChampion sync server";
in
''
if ${curl} -s -o /dev/null -w "%{http_code}" ${domain} | ${grep} -q "200"; then
if ${curl} -s ${domain} | ${grep} -q "${grepString}"; then
echo "[ OK ] Die Seite hat Statuscode 200 und enthält den String '${grepString}'."
else
echo "[Fail] Der Statuscode ist 200, aber die Seite enthält den String '${grepString}' nicht."
fi
else
echo "[Fail] Die Seite hat keinen Statuscode 200."
fi
'';
networking.firewall.interfaces.wg0.allowedTCPPorts = [
config.services.taskchampion-sync-server.port
];
networking.firewall.interfaces.wg0.allowedUDPPorts = [
config.services.taskchampion-sync-server.port
];
services.taskchampion-sync-server = {
enable = true;
openFirewall = false;
};
}