summary refs log tree commit diff
path: root/nixos/modules/services/web-apps
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2022-01-25 17:19:49 +0100
committerMaximilian Bosch <maximilian@mbosch.me>2022-01-25 17:19:49 +0100
commite211c94b94f0327958dae20537f43551e3a1a653 (patch)
treea63f6a793dd72abc4b6e562589fc00be6aee63ce /nixos/modules/services/web-apps
parent6ea0d68c4da8a61f8ff41eb046a7c8f9c9b1c2fe (diff)
downloadnixpkgs-e211c94b94f0327958dae20537f43551e3a1a653.tar
nixpkgs-e211c94b94f0327958dae20537f43551e3a1a653.tar.gz
nixpkgs-e211c94b94f0327958dae20537f43551e3a1a653.tar.bz2
nixpkgs-e211c94b94f0327958dae20537f43551e3a1a653.tar.lz
nixpkgs-e211c94b94f0327958dae20537f43551e3a1a653.tar.xz
nixpkgs-e211c94b94f0327958dae20537f43551e3a1a653.tar.zst
nixpkgs-e211c94b94f0327958dae20537f43551e3a1a653.zip
plausible: 1.4.0 -> 1.4.3
ChangeLog: https://github.com/plausible/analytics/blob/v1.4.3/CHANGELOG.md#unreleased

Also makes the option `services.plausible.releaseCookiePath` mandatory[1]: since Elixir
1.13 the `RELEASE_COOKIE` env-var *must* be set, otherwise the startup
fails[2]. Since we drop `$out/releases/COOKIE` in the `fixupPhase` of
`mixRelease` and Elixir seems to always attempt to generate such a
file[3], I figured it's reasonable to just make it mandatory now.

Closes #155575

[1] https://nixos.org/manual/nixos/stable/options.html#opt-services.plausible.releaseCookiePath
[2] https://github.com/elixir-lang/elixir/commit/f24eb2c1ef3cfb345e9420945c57f276148c0a89 /
    https://github.com/elixir-lang/elixir/issues/11114
[3] https://hexdocs.pm/mix/Mix.Tasks.Release.html, see `:cookie`
Diffstat (limited to 'nixos/modules/services/web-apps')
-rw-r--r--nixos/modules/services/web-apps/plausible.nix15
1 files changed, 7 insertions, 8 deletions
diff --git a/nixos/modules/services/web-apps/plausible.nix b/nixos/modules/services/web-apps/plausible.nix
index b6c48186a1d..5d550ae5ca8 100644
--- a/nixos/modules/services/web-apps/plausible.nix
+++ b/nixos/modules/services/web-apps/plausible.nix
@@ -10,8 +10,7 @@ in {
     enable = mkEnableOption "plausible";
 
     releaseCookiePath = mkOption {
-      default = null;
-      type = with types; nullOr (either str path);
+      type = with types; either str path;
       description = ''
         The path to the file with release cookie. (used for remote connection to the running node).
       '';
@@ -235,6 +234,8 @@ in {
           script = ''
             export CONFIG_DIR=$CREDENTIALS_DIRECTORY
 
+            export RELEASE_COOKIE="$(< $CREDENTIALS_DIRECTORY/RELEASE_COOKIE )"
+
             # setup
             ${pkgs.plausible}/createdb.sh
             ${pkgs.plausible}/migrate.sh
@@ -243,10 +244,8 @@ in {
                 psql -d plausible <<< "UPDATE users SET email_verified=true;"
               fi
             ''}
-            ${optionalString (cfg.releaseCookiePath != null) ''
-              export RELEASE_COOKIE="$(< $CREDENTIALS_DIRECTORY/RELEASE_COOKIE )"
-            ''}
-            plausible start
+
+            exec plausible start
           '';
 
           serviceConfig = {
@@ -257,8 +256,8 @@ in {
             LoadCredential = [
               "ADMIN_USER_PWD:${cfg.adminUser.passwordFile}"
               "SECRET_KEY_BASE:${cfg.server.secretKeybaseFile}"
-            ] ++ lib.optionals (cfg.mail.smtp.passwordFile != null) [ "SMTP_USER_PWD:${cfg.mail.smtp.passwordFile}"]
-            ++ lib.optionals (cfg.releaseCookiePath != null) [ "RELEASE_COOKIE:${cfg.releaseCookiePath}"];
+              "RELEASE_COOKIE:${cfg.releaseCookiePath}"
+            ] ++ lib.optionals (cfg.mail.smtp.passwordFile != null) [ "SMTP_USER_PWD:${cfg.mail.smtp.passwordFile}"];
           };
         };
       }