2022-01-17 20:07:20 +00:00
|
|
|
{ pkgs, ... }: {
|
2022-01-17 19:53:47 +00:00
|
|
|
systemd.services.chirrs = {
|
|
|
|
enable = true;
|
2022-01-17 20:07:20 +00:00
|
|
|
description = "chir.rs";
|
2022-01-17 19:54:58 +00:00
|
|
|
script = "${pkgs.chir-rs}/chir-rs-server";
|
2022-01-17 19:53:47 +00:00
|
|
|
serviceConfig = {
|
2022-01-17 19:54:58 +00:00
|
|
|
WorkingDirectory = pkgs.chir-rs;
|
2022-01-17 19:53:47 +00:00
|
|
|
EnvironmentFile = "/run/secrets/services/chir.rs";
|
|
|
|
};
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
};
|
2022-01-17 20:07:20 +00:00
|
|
|
services.nginx.virtualHosts."api.chir.rs" = {
|
|
|
|
sslCertificate = "/var/lib/acme/chir.rs/cert.pem";
|
|
|
|
sslCertificateKey = "/var/lib/acme/chir.rs/key.pem";
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://localhost:8621/api.chir.rs/";
|
|
|
|
};
|
|
|
|
};
|
2022-01-18 07:41:47 +00:00
|
|
|
services.postgresql.ensureDatabases = [ "homepage" ];
|
|
|
|
services.postgresql.ensureUsers = [{
|
|
|
|
name = "homepage";
|
|
|
|
ensurePermissions = { "DATABASE homepage" = "ALL PRIVILEGES"; };
|
|
|
|
}];
|
2022-01-18 10:36:50 +00:00
|
|
|
sops.secrets."services/chir.rs" = { };
|
2022-01-17 19:53:47 +00:00
|
|
|
}
|