2022-01-17 09:53:15 +00:00
|
|
|
{ config, ... }: {
|
2022-01-17 10:27:07 +00:00
|
|
|
imports = [
|
2022-01-17 11:00:18 +00:00
|
|
|
/run/secrets/services/gitea.nix
|
2022-01-17 10:27:07 +00:00
|
|
|
];
|
2022-01-17 09:49:37 +00:00
|
|
|
services.gitea = {
|
|
|
|
enable = true;
|
|
|
|
appName = "Lotte's Git";
|
2022-01-17 09:53:15 +00:00
|
|
|
cookieSecure = true;
|
2022-01-17 09:49:37 +00:00
|
|
|
database = {
|
|
|
|
host = "localhost";
|
|
|
|
name = "gitea";
|
|
|
|
user = "gitea";
|
2022-01-17 10:36:05 +00:00
|
|
|
type = "postgres";
|
2022-01-17 09:49:37 +00:00
|
|
|
};
|
|
|
|
domain = "git.chir.rs";
|
|
|
|
dump.enable = true;
|
|
|
|
httpAddress = "127.0.0.1";
|
|
|
|
lfs.enable = true;
|
|
|
|
rootUrl = "https://git.chir.rs/";
|
2022-01-17 10:37:34 +00:00
|
|
|
settings = rec {
|
2022-01-17 09:49:37 +00:00
|
|
|
lfs = {
|
2022-01-17 10:36:05 +00:00
|
|
|
STORAGE_TYPE = "default";
|
2022-01-17 09:49:37 +00:00
|
|
|
};
|
|
|
|
storage = {
|
|
|
|
STORAGE_TYPE = "minio";
|
2022-01-17 10:05:02 +00:00
|
|
|
MINIO_ENDPOINT = "minio.int.chir.rs:443";
|
2022-01-17 10:27:07 +00:00
|
|
|
MINIO_ACCESS_KEY_ID = "gitea";
|
2022-01-17 09:49:37 +00:00
|
|
|
MINIO_BUCKET = "gitea";
|
|
|
|
MINIO_USE_SSL = "true";
|
|
|
|
};
|
2022-01-17 10:37:34 +00:00
|
|
|
"storage.default" = storage;
|
2022-01-17 09:49:37 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-01-17 09:53:15 +00:00
|
|
|
services.nginx.virtualHosts."git.chir.rs" = {
|
|
|
|
forceSSL = true;
|
|
|
|
http2 = true;
|
|
|
|
listenAddresses = [ "0.0.0.0" "[::]" ];
|
|
|
|
sslCertificate = "/var/lib/acme/chir.rs/cert.pem";
|
|
|
|
sslCertificateKey = "/var/lib/acme/chir.rs/key.pem";
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://${config.services.gitea.httpAddress}:${toString config.services.gitea.httpPort}/";
|
|
|
|
proxyWebsockets = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-01-17 09:49:37 +00:00
|
|
|
services.postgresql.ensureDatabases = [ "gitea" ];
|
|
|
|
services.postgresql.ensureUsers = [{
|
|
|
|
name = "gitea";
|
|
|
|
ensurePermissions = { "DATABASE gitea" = "ALL PRIVILEGES"; };
|
|
|
|
}];
|
|
|
|
|
|
|
|
systemd.services.gitea.serviceConfig.EnvironmentFile = "/run/secrets/services/gitea";
|
|
|
|
}
|