web-01/plausible: Fix fuckery from happysalada

This commit is contained in:
Tom Hubrecht 2023-07-02 17:17:20 +02:00
parent 660a35c7bb
commit 4327bac6e4
3 changed files with 40 additions and 0 deletions

View file

@ -25,6 +25,8 @@ in
baseUrl = "https://${host}"; baseUrl = "https://${host}";
inherit port; inherit port;
disableRegistration = false;
secretKeybaseFile = config.age.secrets."plausible_secret-key-base-file".path; secretKeybaseFile = config.age.secrets."plausible_secret-key-base-file".path;
}; };
@ -51,5 +53,7 @@ in
}; };
}; };
# dgn-secrets.options."_smtp-password-file".owner = "plausible";
#
networking.firewall.allowedTCPPorts = [ 80 443 ]; networking.firewall.allowedTCPPorts = [ 80 443 ];
} }

31
nix-patches/241126.patch Normal file
View file

@ -0,0 +1,31 @@
From d7e721f614aef3e6bd7f4dfb6c1526e00d257fad Mon Sep 17 00:00:00 2001
From: Raito Bezarius <masterancpp@gmail.com>
Date: Sun, 2 Jul 2023 17:03:53 +0200
Subject: [PATCH] plausible: fix admin user password seed and SMTP passwords
LoadCredential was misused as it is not building any environment variable,
it is the responsibility of our preStart to do it so
Plausible's script can pick it up.
---
nixos/modules/services/web-apps/plausible.nix | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/nixos/modules/services/web-apps/plausible.nix b/nixos/modules/services/web-apps/plausible.nix
index 893dfa10acbc0..911daa53e6587 100644
--- a/nixos/modules/services/web-apps/plausible.nix
+++ b/nixos/modules/services/web-apps/plausible.nix
@@ -238,9 +238,12 @@ in {
path = [ cfg.package ]
++ optional cfg.database.postgres.setup config.services.postgresql.package;
script = ''
- export CONFIG_DIR=$CREDENTIALS_DIRECTORY
-
export RELEASE_COOKIE="$(< $CREDENTIALS_DIRECTORY/RELEASE_COOKIE )"
+ export ADMIN_USER_PWD="$(< $CREDENTIALS_DIRECTORY/ADMIN_USER_PWD )"
+ export SECRET_KEY_BASE="$(< $CREDENTIALS_DIRECTORY/SECRET_KEY_BASE )"
+
+ ${lib.optionalString (cfg.mail.smtp.passwordFile != null)
+ ''export SMTP_USER_PWD="$(< $CREDENTIALS_DIRECTORY/SMTP_USER_PWD )"''}
# setup
${cfg.package}/createdb.sh

5
nix-patches/default.nix Normal file
View file

@ -0,0 +1,5 @@
{
"nixos-23.05" = [
./241126.patch
];
}