Add forgejo crowdsec config
Some checks are pending
/ Build Nix targets (push) Waiting to run

This commit is contained in:
Théo Barnouin 2025-04-14 14:39:52 +02:00
parent 8b007885cd
commit 6d7d5578c4
3 changed files with 56 additions and 17 deletions

View file

@ -14,24 +14,49 @@ in {
};
};
config = lib.mkIf cfg.enable {
age.secrets.forgejoDBPass.file = ./secrets/forgejoDBPass.age;
services.forgejo = {
enable = true;
package = pkgs.forgejo;
user = "tbarnouin";
settings = {
server.HTTP_PORT = 3000;
server.DISABLE_SSH = true;
server.ROOT_URL = "https://git.le43.eu";
service.DISABLE_REGISTRATION = true;
age.secrets = {
forgejo-lapi-key = {
file = ../../secrets/forgejo-lapi-key.age;
owner = "crowdsec";
};
database = {
createDatabase = false;
type = "postgres";
host = "${cfg.pgsql_ip}";
name = "gitea";
user = "gitea";
passwordFile = config.age.secrets.forgejoDBPass.path;
forgejoDBPass.file = ./secrets/forgejoDBPass.age;
};
services = {
crowdsec = {
hub.collections = [
"LePresidente/gitea"
];
settings.lapi.credentialsFile = "${config.age.secrets.forgejo-lapi-key.path}";
localConfig = {
acquisitions = [
{
source = "journalctl";
journalctl_filter = [ "_SYSTEMD_UNIT=forgejo.service" ];
labels = {
type = "syslog";
};
}
];
};
};
forgejo = {
enable = true;
package = pkgs.forgejo;
user = "tbarnouin";
settings = {
server.HTTP_PORT = 3000;
server.DISABLE_SSH = true;
server.ROOT_URL = "https://git.le43.eu";
service.DISABLE_REGISTRATION = true;
};
database = {
createDatabase = false;
type = "postgres";
host = "${cfg.pgsql_ip}";
name = "gitea";
user = "gitea";
passwordFile = config.age.secrets.forgejoDBPass.path;
};
};
};
networking.firewall.allowedTCPPorts = [3000];