From 4327bac6e48629c08f22ace62eb5e1929fb4d3e8 Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Sun, 2 Jul 2023 17:17:20 +0200 Subject: [PATCH] web-01/plausible: Fix fuckery from happysalada --- machines/web-01/plausible.nix | 4 ++++ nix-patches/241126.patch | 31 +++++++++++++++++++++++++++++++ nix-patches/default.nix | 5 +++++ 3 files changed, 40 insertions(+) create mode 100644 nix-patches/241126.patch create mode 100644 nix-patches/default.nix diff --git a/machines/web-01/plausible.nix b/machines/web-01/plausible.nix index 3dc1118..95263c5 100644 --- a/machines/web-01/plausible.nix +++ b/machines/web-01/plausible.nix @@ -25,6 +25,8 @@ in baseUrl = "https://${host}"; inherit port; + disableRegistration = false; + 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 ]; } diff --git a/nix-patches/241126.patch b/nix-patches/241126.patch new file mode 100644 index 0000000..5496754 --- /dev/null +++ b/nix-patches/241126.patch @@ -0,0 +1,31 @@ +From d7e721f614aef3e6bd7f4dfb6c1526e00d257fad Mon Sep 17 00:00:00 2001 +From: Raito Bezarius +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 diff --git a/nix-patches/default.nix b/nix-patches/default.nix new file mode 100644 index 0000000..4740621 --- /dev/null +++ b/nix-patches/default.nix @@ -0,0 +1,5 @@ +{ + "nixos-23.05" = [ + ./241126.patch + ]; +}