]>
Commit | Line | Data |
---|---|---|
1247e537 | 1 | { varDir ? "/var/lib/etherpad-lite" # if you override this change the StateDirectory in service file too! |
4b0a82cc | 2 | , stdenv, callPackage, mylibs, lib }: |
1247e537 | 3 | let |
4b0a82cc IB |
4 | nodeEnv = callPackage mylibs.nodeEnv {}; |
5 | moduleNames = [ | |
6 | "ep_aa_file_menu_toolbar" "ep_adminpads" "ep_align" "ep_bookmark" | |
7 | "ep_clear_formatting" "ep_colors" "ep_comments_page" | |
8 | "ep_copy_paste_select_all" "ep_cursortrace" "ep_delete_empty_pads" | |
9 | "ep_embedmedia" "ep_font_family" "ep_font_size" "ep_headings2" | |
10 | "ep_immae_buttons" "ep_ldapauth" "ep_line_height" "ep_markdown" | |
11 | "ep_mypads" "ep_page_view" "ep_previewimages" "ep_ruler" | |
12 | "ep_scrollto" "ep_set_title_on_pad" "ep_subscript_and_superscript" | |
13 | "ep_timesliderdiff" | |
14 | ]; | |
15 | # nix files are built using node2nix -i node-packages.json | |
16 | allModules = lib.attrsets.genAttrs moduleNames | |
17 | (name: (callPackage (./modules + "/${name}/node-packages.nix") { inherit nodeEnv; }).${name}); | |
18 | toPassthru = pkg: { | |
19 | inherit varDir allModules; | |
20 | withModules = withModules pkg; | |
1247e537 | 21 | }; |
4b0a82cc IB |
22 | withModules = pkg: toModules: |
23 | let | |
24 | modules = toModules allModules; | |
25 | toInstallModule = n: '' | |
26 | cp -a ${n}/lib/node_modules/${n.packageName} $out/node_modules | |
27 | if [ ! -f $out/node_modules/${n.packageName}/.ep_initialized ]; then | |
28 | chmod u+w $out/node_modules/${n.packageName}/ | |
29 | ln -s ${varDir}/ep_initialized/${n.packageName} $out/node_modules/${n.packageName}/.ep_initialized | |
30 | fi | |
31 | ''; | |
32 | newEtherpad = pkg.overrideAttrs(old: { | |
33 | installPhase = old.installPhase + "\n" + builtins.concatStringsSep "\n" (map toInstallModule modules); | |
34 | passthru = toPassthru newEtherpad; | |
35 | }); | |
36 | in newEtherpad; | |
1247e537 IB |
37 | # built using node2nix -l package-lock.json |
38 | # and changing "./." to "src" | |
39 | node-environment = (callPackage ./node-packages.nix { | |
4b0a82cc | 40 | inherit nodeEnv; |
1247e537 IB |
41 | src = stdenv.mkDerivation (mylibs.fetchedGithub ./etherpad-lite.json // rec { |
42 | patches = [ ./libreoffice_patch.diff ]; | |
43 | buildPhase = '' | |
44 | touch src/.ep_initialized | |
1247e537 IB |
45 | ''; |
46 | installPhase = '' | |
47 | cp -a src/ $out | |
48 | ''; | |
49 | }); | |
50 | }).package; | |
51 | package = stdenv.mkDerivation rec { | |
52 | name = (mylibs.fetchedGithub ./etherpad-lite.json).name; | |
53 | src = node-environment; | |
54 | installPhase = '' | |
55 | mkdir -p $out | |
56 | mkdir $out/node_modules | |
57 | cp -a lib/node_modules/ep_etherpad-lite $out/src | |
58 | chmod u+w $out/src/static/js/ | |
1247e537 IB |
59 | ln -s ../src $out/node_modules/ep_etherpad-lite |
60 | ''; | |
4b0a82cc | 61 | passthru = toPassthru package; |
1247e537 IB |
62 | }; |
63 | in package |