aboutsummaryrefslogtreecommitdiff
path: root/pkgs/webapps/dokuwiki
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2020-05-08 23:59:21 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2020-05-09 00:30:49 +0200
commit34c7b88e16d1768b1b9a0cfa6dd21ea5d9b1b308 (patch)
treeb0ace6db106ee8ce19ee17c4cc798dcccf5c77f9 /pkgs/webapps/dokuwiki
parentc4216ddb8bedd0b75149c039bd5dc86c3d6a9b7f (diff)
downloadNix-34c7b88e16d1768b1b9a0cfa6dd21ea5d9b1b308.tar.gz
Nix-34c7b88e16d1768b1b9a0cfa6dd21ea5d9b1b308.tar.zst
Nix-34c7b88e16d1768b1b9a0cfa6dd21ea5d9b1b308.zip
Use new withPlugin system
- dokuwiki - mantisbt - mediagoblin - roundcube - ttrss - yourls
Diffstat (limited to 'pkgs/webapps/dokuwiki')
-rw-r--r--pkgs/webapps/dokuwiki/default.nix42
1 files changed, 22 insertions, 20 deletions
diff --git a/pkgs/webapps/dokuwiki/default.nix b/pkgs/webapps/dokuwiki/default.nix
index 9df88c6..874f0d8 100644
--- a/pkgs/webapps/dokuwiki/default.nix
+++ b/pkgs/webapps/dokuwiki/default.nix
@@ -1,4 +1,4 @@
1{ varDir ? "/var/lib/dokuwiki", preload ? "", lib, stdenv, mylibs, writeText }: 1{ varDir ? "/var/lib/dokuwiki", preload ? "", lib, callPackage, stdenv, mylibs, writeText }:
2let 2let
3 preloadFile = plugins: let preloads = [preload] 3 preloadFile = plugins: let preloads = [preload]
4 ++ builtins.concatMap (p: lib.optional (lib.hasAttr "preload" p) (p.preload p)) plugins; 4 ++ builtins.concatMap (p: lib.optional (lib.hasAttr "preload" p) (p.preload p)) plugins;
@@ -6,21 +6,26 @@ let
6 <?php 6 <?php
7 '' + builtins.concatStringsSep "\n" preloads 7 '' + builtins.concatStringsSep "\n" preloads
8 ); 8 );
9 withPlugins = plugins: package.overrideAttrs(old: { 9 pluginNames = [ "farmer" "todo" ];
10 name = "${old.name}-with-plugins"; 10 allPlugins = lib.attrsets.genAttrs pluginNames
11 installPhase = old.installPhase + ( 11 (name: callPackage (./plugins + "/${name}.nix") {});
12 builtins.concatStringsSep "\n" ( 12 toPassthru = pkg: plugins: {
13 map (value: "ln -sf ${value} $out/lib/plugins/${value.pluginName}") plugins 13 inherit plugins varDir allPlugins;
14 ) 14 withPlugins = withPlugins pkg;
15 ); 15 };
16 installPreloadPhase = '' 16 withPlugins = pkg: toPlugins:
17 cp ${preloadFile plugins} $out/inc/preload.php 17 let
18 ''; 18 plugins = toPlugins allPlugins;
19 passthru = old.passthru // { 19 toInstallPlugin = n:
20 inherit plugins; 20 "ln -sf ${n} $out/lib/plugins/${n.pluginName}";
21 withPlugins = morePlugins: old.withPlugins (morePlugins ++ plugins); 21 newDokuwiki = pkg.overrideAttrs(old: {
22 }; 22 installPhase = old.installPhase + "\n" + builtins.concatStringsSep "\n" (map toInstallPlugin plugins);
23 }); 23 installPreloadPhase = ''
24 cp ${preloadFile (pkg.plugins ++ plugins)} $out/inc/preload.php
25 '';
26 passthru = toPassthru newDokuwiki (pkg.plugins ++ plugins);
27 });
28 in newDokuwiki;
24 package = stdenv.mkDerivation (mylibs.fetchedGithub ./dokuwiki.json // rec { 29 package = stdenv.mkDerivation (mylibs.fetchedGithub ./dokuwiki.json // rec {
25 phases = "unpackPhase buildPhase installPhase installPreloadPhase fixupPhase"; 30 phases = "unpackPhase buildPhase installPhase installPreloadPhase fixupPhase";
26 buildPhase = '' 31 buildPhase = ''
@@ -35,9 +40,6 @@ let
35 installPreloadPhase = '' 40 installPreloadPhase = ''
36 cp ${preloadFile []} $out/inc/preload.php 41 cp ${preloadFile []} $out/inc/preload.php
37 ''; 42 '';
38 passthru = { 43 passthru = toPassthru package [];
39 plugins = [];
40 inherit withPlugins varDir;
41 };
42 }); 44 });
43in package 45in package