nixos-config/machines/orbi/service-forgejo.nix
2024-09-15 07:22:02 +07:00

57 lines
1.4 KiB
Nix

{
config,
lib,
pkgs,
...
}:
{
verify.localCommands.forgejo =
let
domain = "https://git.ingolf-wagner.de/explore/repos";
curl = lib.getExe pkgs.curl;
grep = lib.getExe pkgs.gnugrep;
grepString = "palo/nixos-config";
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
'';
services.nginx = {
enable = true;
statusPage = true;
virtualHosts = {
"git.ingolf-wagner.de" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://localhost:${toString config.services.forgejo.settings.server.HTTP_PORT}";
};
};
};
};
services.forgejo = {
enable = true;
settings = {
server.ROOT_URL = "https://git.ingolf-wagner.de/";
server.DOMAIN = "git.ingolf-wagner.de";
DEFAULT.APP_NAME = "git.ingolf-wagner.de";
service.DISABLE_REGISTRATION = true;
session.COOKIE_SECURE = true;
log.LEVEL = "Warn";
other = {
SHOW_FOOTER_VERSION = false;
};
};
};
}