From a8bfce17c5eda890d3486357952572f4c1c6b18a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Wed, 8 May 2019 10:56:21 +0200 Subject: Move etherpad-lite to pkgs --- pkgs/impure/etherpad-lite/default.nix | 69 ++++++++++++++++++++++++ pkgs/impure/etherpad-lite/etherpad-lite.json | 15 ++++++ pkgs/impure/etherpad-lite/libreoffice_patch.diff | 11 ++++ 3 files changed, 95 insertions(+) create mode 100644 pkgs/impure/etherpad-lite/default.nix create mode 100644 pkgs/impure/etherpad-lite/etherpad-lite.json create mode 100644 pkgs/impure/etherpad-lite/libreoffice_patch.diff (limited to 'pkgs/impure/etherpad-lite') diff --git a/pkgs/impure/etherpad-lite/default.nix b/pkgs/impure/etherpad-lite/default.nix new file mode 100644 index 0000000..c85bd7e --- /dev/null +++ b/pkgs/impure/etherpad-lite/default.nix @@ -0,0 +1,69 @@ +{ session_key ? "/etc/etherpad-lite/SESSIONKEY.txt" +, api_key ? "/etc/etherpad-lite/APIKEY.txt" +, stdenv, mylibs, cacert, nodejs, python, fetchurl }: +let + jquery = fetchurl { + url = https://code.jquery.com/jquery-1.9.1.js; + sha256 = "0h4dk67yc9d0kadqxb6b33585f3x3559p6qmp70l00qwq030vn3v"; + }; + withModules = modules: package.overrideAttrs(old: { + buildPhase = old.buildPhase + + builtins.concatStringsSep "\n" + (map (n: "npm install ${n}; touch node_modules/${n}/.ep_initialized") modules); + # FIXME: ln -s don’t seem to work, etherpad seems + # unable to "touch" them after initialization + passthru = old.passthru // { + inherit modules; + withModules = moreModules: old.withModules (moreModules ++ modules); + }; + }); + package = stdenv.mkDerivation (mylibs.fetchedGithub ./etherpad-lite.json // rec { + __noChroot = true; + patches = [ ./libreoffice_patch.diff ]; + buildPhase = '' + export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt + export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt + export HOME=$PWD + + touch src/.ep_initialized + cp -v src/static/custom/js.template src/static/custom/index.js + cp -v src/static/custom/js.template src/static/custom/pad.js + cp -v src/static/custom/js.template src/static/custom/timeslider.js + cp -v src/static/custom/css.template src/static/custom/index.css + cp -v src/static/custom/css.template src/static/custom/pad.css + cp -v src/static/custom/css.template src/static/custom/timeslider.css + + sed -i 's/var\/dirty.db/\/var\/lib\/etherpad-lite\/dirty.db/g' \ + settings.json.template + + mkdir -v node_modules + ln -s ../src node_modules/ep_etherpad-lite + + node bin/doc/generate doc/index.md --format=html \ + --template=doc/template.html > documentation.html + + cd src + npm install + cd .. + ''; + installPhase = '' + mkdir -p $out + install -t $out/src/ -vDm 644 src/.ep_initialized + cp -a node_modules $out/ + cp -a src/* $out/src/ + ln -sf ${session_key} $out/SESSIONKEY.txt + ln -sf ${api_key} $out/APIKEY.txt + cp ${jquery} $out/src/static/js/jquery.js + + mkdir $out/doc + install -t "$out/doc/" \ + -vDm 644 {CHANGELOG,CONTRIBUTING,README}.md \ + -vDm 644 documentation.html + ''; + buildInputs = [ nodejs python ]; + passthru = { + modules = []; + inherit withModules; + }; + }); +in package diff --git a/pkgs/impure/etherpad-lite/etherpad-lite.json b/pkgs/impure/etherpad-lite/etherpad-lite.json new file mode 100644 index 0000000..81369c4 --- /dev/null +++ b/pkgs/impure/etherpad-lite/etherpad-lite.json @@ -0,0 +1,15 @@ +{ + "tag": "1.7.0", + "meta": { + "name": "etherpad-lite", + "url": "https://github.com/ether/etherpad-lite", + "branch": "refs/tags/1.7.0" + }, + "github": { + "owner": "ether", + "repo": "etherpad-lite", + "rev": "96ac381afb9ea731dad48968f15d77dc6488bd0d", + "sha256": "03k6bwlm9ch9kssy9jipfg8ij7rpbzd89xq4mvg4grg1q6ivnzk9", + "fetchSubmodules": true + } +} diff --git a/pkgs/impure/etherpad-lite/libreoffice_patch.diff b/pkgs/impure/etherpad-lite/libreoffice_patch.diff new file mode 100644 index 0000000..d9e3dfc --- /dev/null +++ b/pkgs/impure/etherpad-lite/libreoffice_patch.diff @@ -0,0 +1,11 @@ +--- a/src/node/utils/LibreOffice.js 2018-06-18 09:54:15.087161212 +0200 ++++ b/src/node/utils/LibreOffice.js 2018-06-18 10:33:27.534055021 +0200 +@@ -63,6 +63,7 @@ + '--invisible', + '--nologo', + '--nolockcheck', ++ '-env:UserInstallation=file:///tmp/', + '--convert-to', task.type, + task.srcFile, + '--outdir', tmpDir + -- cgit v1.2.3