From 9cf4c745f619558f8bdac0efaf225657a00f921b Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Wed, 2 Nov 2022 21:38:40 +0100 Subject: [PATCH] Add a WIP ttrss solution with postgres --- modules/ttrss-postgres/default.nix | 47 ++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 modules/ttrss-postgres/default.nix diff --git a/modules/ttrss-postgres/default.nix b/modules/ttrss-postgres/default.nix new file mode 100644 index 0000000..f8795cd --- /dev/null +++ b/modules/ttrss-postgres/default.nix @@ -0,0 +1,47 @@ +{ inputs, pkgs, ... }: +let + domain = "test.2li.ch"; +in +{ + imports = [ + (import "${inputs.self}/modules/nginx-fpm" { + dataDir = "/mnt/data/ttrss/app"; + inherit domain inputs pkgs; + }) + "${inputs.self}/modules/data-share" + "${inputs.self}/modules/docker" + "${inputs.self}/modules/postgresql" + ]; + + 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 = { + backend = "docker"; + 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"; + TTRSS_SELF_URL_PATH = "https://test.2li.ch"; + }; + # environmentFiles = ""; + ports = [ + "8080:80" + ]; + volumes = [ + "/home/andreas/ttrss/config:/config" + ]; + extraOptions = [ "--add-host=host.docker.internal:host-gateway" ]; + }; + }; +}