plausible: minor polishing
This commit is contained in:
parent
1ed65d4bf6
commit
cc88797ce0
|
@ -190,7 +190,7 @@ in {
|
||||||
environment = {
|
environment = {
|
||||||
# NixOS specific option to avoid that it's trying to write into its store-path.
|
# NixOS specific option to avoid that it's trying to write into its store-path.
|
||||||
# See also https://github.com/lau/tzdata#data-directory-and-releases
|
# See also https://github.com/lau/tzdata#data-directory-and-releases
|
||||||
PLAUSIBLE_TZDATA = "/var/lib/plausible/elixir_tzdata";
|
TZDATA_DIR = "/var/lib/plausible/elixir_tzdata";
|
||||||
|
|
||||||
# Configuration options from
|
# Configuration options from
|
||||||
# https://plausible.io/docs/self-hosting-configuration
|
# https://plausible.io/docs/self-hosting-configuration
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import ./make-test-python.nix ({ pkgs, lib, ... }: {
|
import ./make-test-python.nix ({ pkgs, lib, ... }: {
|
||||||
name = "plausible";
|
name = "plausible";
|
||||||
meta = with pkgs.stdenv.lib.maintainers; {
|
meta = with lib.maintainers; {
|
||||||
maintainers = [ ma27 ];
|
maintainers = [ ma27 ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
{ lib, stdenv, beamPackages, fetchFromGitHub, glibcLocales, cacert
|
{ lib
|
||||||
, mkYarnModules, nodejs, fetchpatch, nixosTests
|
, stdenv
|
||||||
|
, beamPackages
|
||||||
|
, fetchFromGitHub
|
||||||
|
, glibcLocales
|
||||||
|
, cacert
|
||||||
|
, mkYarnModules
|
||||||
|
, nodejs
|
||||||
|
, fetchpatch
|
||||||
|
, nixosTests
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -37,7 +45,8 @@ let
|
||||||
echo 'module.exports = {}' > $out/node_modules/flatpickr/dist/postcss.config.js
|
echo 'module.exports = {}' > $out/node_modules/flatpickr/dist/postcss.config.js
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in beamPackages.mixRelease {
|
in
|
||||||
|
beamPackages.mixRelease {
|
||||||
inherit pname version src mixFodDeps;
|
inherit pname version src mixFodDeps;
|
||||||
|
|
||||||
nativeBuildInputs = [ nodejs ];
|
nativeBuildInputs = [ nodejs ];
|
||||||
|
@ -50,6 +59,10 @@ in beamPackages.mixRelease {
|
||||||
sha256 = "sha256-JvJ7xlGw+tHtWje+jiQChVC4KTyqqdq2q+MIcOv/k1o=";
|
sha256 = "sha256-JvJ7xlGw+tHtWje+jiQChVC4KTyqqdq2q+MIcOv/k1o=";
|
||||||
})
|
})
|
||||||
|
|
||||||
|
# Ensure that `tzdata` doesn't write into its store-path
|
||||||
|
# https://github.com/plausible/analytics/pull/1096, but rebased onto 1.3.0
|
||||||
|
./tzdata-rebased.patch
|
||||||
|
|
||||||
# CREATE EXTENSION requires super-user privileges. To avoid that, we just skip
|
# CREATE EXTENSION requires super-user privileges. To avoid that, we just skip
|
||||||
# the responsible SQL statement here and take care of it in the module.
|
# the responsible SQL statement here and take care of it in the module.
|
||||||
./skip-create-ext.patch
|
./skip-create-ext.patch
|
||||||
|
@ -60,25 +73,13 @@ in beamPackages.mixRelease {
|
||||||
updateScript = ./update.sh;
|
updateScript = ./update.sh;
|
||||||
};
|
};
|
||||||
|
|
||||||
postPatch = ''
|
postBuild = ''
|
||||||
# Without this modification, tzdata tries to write in its store-path:
|
|
||||||
# https://github.com/lau/tzdata#data-directory-and-releases
|
|
||||||
echo 'config :tzdata, :data_dir, (System.get_env("PLAUSIBLE_TZDATA") || "/tmp/plausible_tzdata")' \
|
|
||||||
>> config/config.exs
|
|
||||||
'';
|
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
runHook preBuild
|
|
||||||
|
|
||||||
mkdir -p $out
|
|
||||||
ln -sf ${yarnDeps}/node_modules assets/node_modules
|
ln -sf ${yarnDeps}/node_modules assets/node_modules
|
||||||
npm run deploy --prefix ./assets
|
npm run deploy --prefix ./assets
|
||||||
|
|
||||||
# for external task you need a workaround for the no deps check flag
|
# for external task you need a workaround for the no deps check flag
|
||||||
# https://github.com/phoenixframework/phoenix/issues/2690
|
# https://github.com/phoenixframework/phoenix/issues/2690
|
||||||
mix do deps.loadpaths --no-deps-check, phx.digest
|
mix do deps.loadpaths --no-deps-check, phx.digest
|
||||||
|
|
||||||
runHook postBuild
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
|
|
21
pkgs/servers/web-apps/plausible/tzdata-rebased.patch
Normal file
21
pkgs/servers/web-apps/plausible/tzdata-rebased.patch
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
diff --git a/config/runtime.exs b/config/runtime.exs
|
||||||
|
index 7c9cc14..8facd05 100644
|
||||||
|
--- a/config/runtime.exs
|
||||||
|
+++ b/config/runtime.exs
|
||||||
|
@@ -15,9 +15,7 @@ end
|
||||||
|
base_url = URI.parse(base_url)
|
||||||
|
|
||||||
|
if base_url.scheme not in ["http", "https"] do
|
||||||
|
- raise "BASE_URL must start with `http` or `https`. Currently configured as `#{
|
||||||
|
- System.get_env("BASE_URL")
|
||||||
|
- }`"
|
||||||
|
+ raise "BASE_URL must start with `http` or `https`. Currently configured as `#{System.get_env("BASE_URL")}`"
|
||||||
|
end
|
||||||
|
|
||||||
|
secret_key_base =
|
||||||
|
@@ -300,3 +298,5 @@ if appsignal_api_key do
|
||||||
|
env: env,
|
||||||
|
active: true
|
||||||
|
end
|
||||||
|
+
|
||||||
|
+config :tzdata, :data_dir, System.get_env("TZDATA_DIR", "priv")
|
Loading…
Reference in a new issue