nixos/modules/ttrss-postgres/default.nix

47 lines
1.3 KiB
Nix
Raw Normal View History

2022-11-04 19:35:57 +01:00
{ custom, domain }: { config, pkgs, ... }:
2022-11-02 21:38:40 +01:00
let
domain = "test.2li.ch";
in
{
imports = [
2022-11-04 19:35:57 +01:00
(import "${custom.inputs.self}/modules/nginx-fpm" {
2022-11-02 21:38:40 +01:00
dataDir = "/mnt/data/ttrss/app";
2022-11-04 19:35:57 +01:00
inherit custom domain pkgs;
2022-11-02 21:38:40 +01:00
})
2022-11-04 19:35:57 +01:00
"${custom.inputs.self}/modules/postgresql"
2022-11-02 21:38:40 +01:00
];
2022-11-04 19:35:57 +01:00
age.secrets.ttrssEnv.file = "${custom.inputs.self}/scrts/ttrss_env.age";
2022-11-02 21:38:40 +01:00
services.postgresql = {
ensureDatabases = [ "ttrssdb" ];
initialScript = pkgs.writeText "postgresql-initScript" ''
CREATE ROLE ttrss WITH LOGIN PASSWORD 'ttrss' CREATEDB;
GRANT ALL PRIVILEGES ON DATABASE ttrssdb TO ttrss;
'';
};
virtualisation.oci-containers = {
2022-11-03 09:37:37 +01:00
backend = "docker";
2022-11-02 21:38:40 +01:00
containers."ttrss" = {
image = "ghcr.io/nebucatnetzer/tt-rss-aarch64/ttrss-fpm-pgsql-static";
autoStart = false;
environment = {
TZ = "Europe/Zurich";
TTRSS_DB_USER = "ttrss";
TTRSS_DB_NAME = "ttrssdb";
TTRSS_DB_PASS = "ttrss";
TTRSS_DB_HOST = "host.docker.internal";
2022-11-03 23:36:21 +01:00
TTRSS_SELF_URL_PATH = "https://${domain}";
2022-11-02 21:38:40 +01:00
};
2022-11-03 23:36:21 +01:00
environmentFiles = [ config.age.secrets.ttrssEnv.path ];
2022-11-02 21:38:40 +01:00
ports = [
"8080:80"
];
volumes = [
2022-11-03 23:36:21 +01:00
"/var/lib/ttrss/config:/config"
2022-11-02 21:38:40 +01:00
];
2022-11-03 23:36:21 +01:00
extraOptions = [ "--add-host=host.docker.internal:host-gateway" ];
2022-11-02 21:38:40 +01:00
};
};
}