diff options
Diffstat (limited to 'pkgs/webapps/dokuwiki/default.nix')
-rw-r--r-- | pkgs/webapps/dokuwiki/default.nix | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/pkgs/webapps/dokuwiki/default.nix b/pkgs/webapps/dokuwiki/default.nix new file mode 100644 index 0000000..7b5d899 --- /dev/null +++ b/pkgs/webapps/dokuwiki/default.nix | |||
@@ -0,0 +1,41 @@ | |||
1 | { varDir ? "/var/lib/dokuwiki", preload ? "", lib, stdenv, mylibs, writeText }: | ||
2 | let | ||
3 | preloadFile = plugins: let preloads = [preload] | ||
4 | ++ builtins.concatMap (p: lib.optional (lib.hasAttr "preload" p) (p.preload p)) plugins; | ||
5 | in writeText "preload.php" ('' | ||
6 | <?php | ||
7 | '' + builtins.concatStringsSep "\n" preloads | ||
8 | ); | ||
9 | withPlugins = plugins: package.overrideAttrs(old: { | ||
10 | name = "${old.name}-with-plugins"; | ||
11 | installPhase = old.installPhase + ( | ||
12 | builtins.concatStringsSep "\n" ( | ||
13 | map (value: "ln -sf ${value} $out/lib/plugins/${value.pluginName}") plugins | ||
14 | ) | ||
15 | ); | ||
16 | installPreloadPhase = '' | ||
17 | cp ${preloadFile plugins} $out/inc/preload.php | ||
18 | ''; | ||
19 | passthru.plugins = plugins; | ||
20 | passthru.withPlugins = morePlugins: old.withPlugins (morePlugins ++ plugins); | ||
21 | }); | ||
22 | package = stdenv.mkDerivation (mylibs.fetchedGithub ./dokuwiki.json // rec { | ||
23 | phases = "unpackPhase buildPhase installPhase installPreloadPhase fixupPhase"; | ||
24 | buildPhase = '' | ||
25 | mv conf conf.dist | ||
26 | mv data data.dist | ||
27 | ''; | ||
28 | installPhase = '' | ||
29 | cp -a . $out | ||
30 | ln -sf ${varDir}/{conf,data} $out/ | ||
31 | ln -sf ${varDir}/conf/.htaccess $out/ | ||
32 | ''; | ||
33 | installPreloadPhase = '' | ||
34 | cp ${preloadFile []} $out/inc/preload.php | ||
35 | ''; | ||
36 | passthru = { | ||
37 | plugins = []; | ||
38 | inherit withPlugins varDir; | ||
39 | }; | ||
40 | }); | ||
41 | in package | ||