mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-01 23:22:37 +00:00
plausible: minor polishing
This commit is contained in:
parent
1ed65d4bf6
commit
cc88797ce0
@ -190,7 +190,7 @@ in {
|
||||
environment = {
|
||||
# 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
|
||||
PLAUSIBLE_TZDATA = "/var/lib/plausible/elixir_tzdata";
|
||||
TZDATA_DIR = "/var/lib/plausible/elixir_tzdata";
|
||||
|
||||
# Configuration options from
|
||||
# https://plausible.io/docs/self-hosting-configuration
|
||||
|
@ -1,6 +1,6 @@
|
||||
import ./make-test-python.nix ({ pkgs, lib, ... }: {
|
||||
name = "plausible";
|
||||
meta = with pkgs.stdenv.lib.maintainers; {
|
||||
meta = with lib.maintainers; {
|
||||
maintainers = [ ma27 ];
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,13 @@
|
||||
{ lib, stdenv, beamPackages, fetchFromGitHub, glibcLocales, cacert
|
||||
, mkYarnModules, nodejs, fetchpatch, nixosTests
|
||||
{ lib
|
||||
, stdenv
|
||||
, beamPackages
|
||||
, fetchFromGitHub
|
||||
, glibcLocales
|
||||
, cacert
|
||||
, mkYarnModules
|
||||
, nodejs
|
||||
, fetchpatch
|
||||
, nixosTests
|
||||
}:
|
||||
|
||||
let
|
||||
@ -37,7 +45,8 @@ let
|
||||
echo 'module.exports = {}' > $out/node_modules/flatpickr/dist/postcss.config.js
|
||||
'';
|
||||
};
|
||||
in beamPackages.mixRelease {
|
||||
in
|
||||
beamPackages.mixRelease {
|
||||
inherit pname version src mixFodDeps;
|
||||
|
||||
nativeBuildInputs = [ nodejs ];
|
||||
@ -50,6 +59,10 @@ in beamPackages.mixRelease {
|
||||
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
|
||||
# the responsible SQL statement here and take care of it in the module.
|
||||
./skip-create-ext.patch
|
||||
@ -60,25 +73,13 @@ in beamPackages.mixRelease {
|
||||
updateScript = ./update.sh;
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
# 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
|
||||
postBuild = ''
|
||||
ln -sf ${yarnDeps}/node_modules assets/node_modules
|
||||
npm run deploy --prefix ./assets
|
||||
|
||||
# for external task you need a workaround for the no deps check flag
|
||||
# https://github.com/phoenixframework/phoenix/issues/2690
|
||||
mix do deps.loadpaths --no-deps-check, phx.digest
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
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 New Issue
Block a user