Add Taiga

Taiga is a project management software, and we desperately need a system
to manage our tasks. After trying several others (OpenProject, Redmine,
leantime) we decided to use Taiga as it appears to be the only system
that provides the possibility of OIDC without an Enterprise subscription.

Having said that, we haven't set up OIDC yet, as the plugin to set it up
appears to be unmaintained and does not support our version of postgres.

This is not the final state of Taiga. After Jenkins and Quay (or
alternatives) are up we will be revisiting Taiga to create an updated
version of the plugin and set up OIDC. For now, only the infrastructure
tasks will be on Taiga.

Change-Id: Iaccc3cd8a2d94762a70b8e6f96a516ca241b552d
Reviewed-on: https://git.clicks.codes/c/Clicks/NixFiles/+/83
Reviewed-by: Samuel Shuert <coded@clicks.codes>
Tested-by: Skyler Grey <minion@clicks.codes>
diff --git a/modules/common/postgres.nix b/modules/common/postgres.nix
index f77346a..30103e8 100644
--- a/modules/common/postgres.nix
+++ b/modules/common/postgres.nix
@@ -4,7 +4,7 @@
 
     package = pkgs.postgresql;
     settings = {
-      listen_addresses = lib.mkForce "standard";
+      listen_addresses = lib.mkForce "standard, 172.20.0.1";
       log_connections = true;
       logging_collector = true;
       log_disconnections = true;
@@ -12,7 +12,7 @@
     };
 
     ensureDatabases =
-      [ "vaultwarden" "gerrit" "privatebin" "keycloak" "nextcloud" "synapse" ];
+      [ "vaultwarden" "gerrit" "privatebin" "keycloak" "nextcloud" "synapse" "taiga" ];
 
     ensureUsers = [
       {
@@ -42,11 +42,17 @@
         name = "nextcloud";
         ensurePermissions = { "DATABASE nextcloud" = "ALL PRIVILEGES"; };
       }
+      {
+        name = "taiga";
+        ensurePermissions = { "DATABASE taiga" = "ALL PRIVILEGES"; };
+      }
     ] ++ (map (name: ({
       inherit name;
       ensurePermissions = { "ALL TABLES IN SCHEMA public" = "ALL PRIVILEGES"; };
     })) [ "minion" "coded" "pineafan" ]);
 
+    #                 method database user address auth-method
+    authentication = "host   all      all  samenet scram-sha-256";
   };
 
   systemd.services.postgresql.postStart = lib.mkMerge [
@@ -85,6 +91,10 @@
         user = "nextcloud";
         passwordFile = config.sops.secrets.clicks_nextcloud_db_password.path;
       }
+      {
+        user = "taiga";
+        passwordFile = config.sops.secrets.clicks_taiga_db_password.path;
+      }
     ] [
       (map (userData: ''
         $PSQL -tAc "ALTER USER ${userData.user} PASSWORD '$(cat ${userData.passwordFile})';"
@@ -99,6 +109,7 @@
     "clicks_vaultwarden_db_password"
     "clicks_privatebin_db_password"
     "clicks_nextcloud_db_password"
+    "clicks_taiga_db_password"
   ] [
     (map (name: {
       inherit name;