git.iko.soy/typeable/nixpkgs
on master help sign in
plausible: minor polishing
commitcc88797ce079d632e1d71b190b40a36efc7ac378 authorMaximilian Bosch <maximilian@mbosch.me> dateTue 1 Jun 2021, 17:59 (5 years ago) parent1ed65d4
4 files changed+40−18
nixos/modules/services/web-apps/plausible.nix+1−1 nixos/tests/plausible.nix+1−1 pkgs/servers/web-apps/plausible/default.nix+17−16 pkgs/servers/web-apps/plausible/tzdata-rebased.patch+21
nixos/modules/services/web-apps/plausible.nix+1−1
@@ -190,7 +190,7 @@ in {
190190 environment = {
191191 # NixOS specific option to avoid that it's trying to write into its store-path.
192192 # See also https://github.com/lau/tzdata#data-directory-and-releases
193− PLAUSIBLE_TZDATA = "/var/lib/plausible/elixir_tzdata";
193+ TZDATA_DIR = "/var/lib/plausible/elixir_tzdata";
194194
195195 # Configuration options from
196196 # https://plausible.io/docs/self-hosting-configuration
nixos/tests/plausible.nix+1−1
@@ -1,6 +1,6 @@
11import ./make-test-python.nix ({ pkgs, lib, ... }: {
22 name = "plausible";
3− meta = with pkgs.stdenv.lib.maintainers; {
3+ meta = with lib.maintainers; {
44 maintainers = [ ma27 ];
55 };
66
pkgs/servers/web-apps/plausible/default.nix+17−16
@@ -1,5 +1,13 @@
1−{ lib, stdenv, beamPackages, fetchFromGitHub, glibcLocales, cacert
2−, mkYarnModules, nodejs, fetchpatch, nixosTests
1+{ lib
2+, stdenv
3+, beamPackages
4+, fetchFromGitHub
5+, glibcLocales
6+, cacert
7+, mkYarnModules
8+, nodejs
9+, fetchpatch
10+, nixosTests
311}:
412
513let
@@ -37,7 +45,8 @@ let
3745 echo 'module.exports = {}' > $out/node_modules/flatpickr/dist/postcss.config.js
3846 '';
3947 };
40−in beamPackages.mixRelease {
48+in
49+beamPackages.mixRelease {
4150 inherit pname version src mixFodDeps;
4251
4352 nativeBuildInputs = [ nodejs ];
@@ -50,6 +59,10 @@ in beamPackages.mixRelease {
5059 sha256 = "sha256-JvJ7xlGw+tHtWje+jiQChVC4KTyqqdq2q+MIcOv/k1o=";
5160 })
5261
62+ # Ensure that `tzdata` doesn't write into its store-path
63+ # https://github.com/plausible/analytics/pull/1096, but rebased onto 1.3.0
64+ ./tzdata-rebased.patch
65+
5366 # CREATE EXTENSION requires super-user privileges. To avoid that, we just skip
5467 # the responsible SQL statement here and take care of it in the module.
5568 ./skip-create-ext.patch
@@ -60,25 +73,13 @@ in beamPackages.mixRelease {
6073 updateScript = ./update.sh;
6174 };
6275
63− postPatch = ''
64− # Without this modification, tzdata tries to write in its store-path:
65− # https://github.com/lau/tzdata#data-directory-and-releases
66− echo 'config :tzdata, :data_dir, (System.get_env("PLAUSIBLE_TZDATA") || "/tmp/plausible_tzdata")' \
67− >> config/config.exs
68− '';
69−
70− buildPhase = ''
71− runHook preBuild
72−
73− mkdir -p $out
76+ postBuild = ''
7477 ln -sf ${yarnDeps}/node_modules assets/node_modules
7578 npm run deploy --prefix ./assets
7679
7780 # for external task you need a workaround for the no deps check flag
7881 # https://github.com/phoenixframework/phoenix/issues/2690
7982 mix do deps.loadpaths --no-deps-check, phx.digest
80−
81− runHook postBuild
8283 '';
8384
8485 meta = with lib; {
pkgs/servers/web-apps/plausible/tzdata-rebased.patchnew file+21
@@ -0,0 +1,21 @@
1+diff --git a/config/runtime.exs b/config/runtime.exs
2+index 7c9cc14..8facd05 100644
3+--- a/config/runtime.exs
4++++ b/config/runtime.exs
5+@@ -15,9 +15,7 @@ end
6+ base_url = URI.parse(base_url)
7+
8+ if base_url.scheme not in ["http", "https"] do
9+- raise "BASE_URL must start with `http` or `https`. Currently configured as `#{
10+- System.get_env("BASE_URL")
11+- }`"
12++ raise "BASE_URL must start with `http` or `https`. Currently configured as `#{System.get_env("BASE_URL")}`"
13+ end
14+
15+ secret_key_base =
16+@@ -300,3 +298,5 @@ if appsignal_api_key do
17+ env: env,
18+ active: true
19+ end
20++
21++config :tzdata, :data_dir, System.get_env("TZDATA_DIR", "priv")