From 45e375168ec46a50fca5e1f08efcb3eacb1aba81 Mon Sep 17 00:00:00 2001 From: soraefir Date: Fri, 15 May 2026 00:12:30 +0200 Subject: [PATCH] db setup immich --- modules/server/containers/apps/immich.nix | 8 ++++++++ modules/server/database/default.nix | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/server/containers/apps/immich.nix b/modules/server/containers/apps/immich.nix index 83d529c..d549b65 100644 --- a/modules/server/containers/apps/immich.nix +++ b/modules/server/containers/apps/immich.nix @@ -43,4 +43,12 @@ in { }; }; + setup = { + trigger = "server"; + script = pkgs.writeShellScript "setup" '' + PSQL="${pkgs.postgresql}/bin/psql" + $PSQL -d "immich_db" -tAc "CREATE EXTENSION IF NOT EXISTS vector;" + $PSQL -d "immich_db" -tAc "CREATE EXTENSION IF NOT EXISTS earthdistance;" + ''; + }; } \ No newline at end of file diff --git a/modules/server/database/default.nix b/modules/server/database/default.nix index 2636b8c..e84f8f5 100644 --- a/modules/server/database/default.nix +++ b/modules/server/database/default.nix @@ -56,7 +56,6 @@ in { PSQL="${pkgs.postgresql}/bin/psql" ${lib.concatMapStringsSep "\n" (name: '' $PSQL -tAc "ALTER DATABASE ${name}_db OWNER TO ${name}_user;" - $PSQL -d "${name}_db" -tAc "CREATE EXTENSION IF NOT EXISTS vector;" if [ -f "${config.sops.secrets."${lib.toUpper name}".path}" ]; then PASS=$(grep "^DB_PASSWORD=" "${config.sops.secrets."${lib.toUpper name}".path}" | cut -d'=' -f2-)