nixos-config/modules/ihatemoney.nix

72 lines
2 KiB
Nix
Raw Normal View History

2024-06-21 17:42:33 +02:00
{ config, lib, ... }:
let
2023-01-31 16:48:31 +01:00
cfg = import ./vars.nix;
port = cfg.ihatemoney.port;
db = cfg.ihatemoney.db;
2024-06-21 17:42:33 +02:00
dbport = cfg.ihatemoney.dbport;
2023-01-31 16:48:31 +01:00
domain = cfg.ihatemoney.domain;
in
{
2023-01-31 16:48:31 +01:00
2024-06-21 17:42:33 +02:00
imports = [
#./podman.nix
./podman-postgresql.nix # for the database
./nginx.nix # for the webserver
];
sops.secrets."${db}/db" = {};
sops.secrets."${db}/env" = {};
services.podman-postgresql."${db}" = {
enable = true;
image = "docker.io/library/postgres:16-alpine";
port = (lib.strings.toInt dbport);
passwordFile = config.sops.secrets."${db}/db".path;
};
2023-01-31 16:48:31 +01:00
2022-10-30 15:51:48 +01:00
services.nginx.virtualHosts."${domain}" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://localhost:${port}";
2024-06-21 17:42:33 +02:00
extraConfig = ''
'';
};
2022-10-30 15:51:48 +01:00
extraConfig = ''
access_log /var/log/nginx/${domain}_access.log;
error_log /var/log/nginx/${domain}_error.log;
2024-06-21 17:42:33 +02:00
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_redirect off;
proxy_connect_timeout 90;
proxy_send_timeout 180;
proxy_read_timeout 180;
proxy_buffer_size 16k;
proxy_buffers 8 16k;
proxy_busy_buffers_size 32k;
proxy_intercept_errors on;
2022-10-30 15:51:48 +01:00
'';
};
2022-03-29 11:25:34 +02:00
2022-09-24 19:19:00 +02:00
virtualisation.oci-containers.containers.ihatemoney = {
2024-06-21 17:42:33 +02:00
image = "docker.io/ihatemoney/ihatemoney";
2022-09-24 19:19:00 +02:00
environment = {
ACTIVATE_ADMIN_DASHBOARD = "True";
ACTIVATE_DEMO_PROJECT = "False";
ALLOW_PUBLIC_PROJECT_CREATION = "False";
MAIL_DEFAULT_SENDER = "Budget manager <ihatemoney@mc-fucker.cool>";
MAIL_SERVER = "mc1.mc-fucker.vpn.mc-fucker.cool";
MAIL_USE_TLS = "True";
DEBUG = "False";
};
2023-01-31 16:48:31 +01:00
ports = [ "${port}:${port}" ];
2024-06-21 17:42:33 +02:00
environmentFiles = [ /run/secrets/ihatemoney/env ];
extraOptions = cfg.podman.extraOptions;
2022-09-24 19:19:00 +02:00
};
}
# vim: set et ts=2 sw=2 ai: