1 { varDir ? "/var/lib/dokuwiki", preload ? "", lib, callPackage, stdenv, mylibs, writeText }:
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" (''
7 '' + builtins.concatStringsSep "\n" preloads
9 pluginNames = [ "farmer" "todo" ];
10 allPlugins = lib.attrsets.genAttrs pluginNames
11 (name: callPackage (./plugins + "/${name}.nix") {});
12 toPassthru = pkg: plugins: {
13 inherit plugins varDir allPlugins;
14 withPlugins = withPlugins pkg;
16 withPlugins = pkg: toPlugins:
18 plugins = toPlugins allPlugins;
20 "ln -sf ${n} $out/lib/plugins/${n.pluginName}";
21 newDokuwiki = pkg.overrideAttrs(old: {
22 installPhase = old.installPhase + "\n" + builtins.concatStringsSep "\n" (map toInstallPlugin plugins);
23 installPreloadPhase = ''
24 cp ${preloadFile (pkg.plugins ++ plugins)} $out/inc/preload.php
26 passthru = toPassthru newDokuwiki (pkg.plugins ++ plugins);
29 package = stdenv.mkDerivation (mylibs.fetchedGithub ./dokuwiki.json // rec {
30 phases = "unpackPhase buildPhase installPhase installPreloadPhase fixupPhase";
37 ln -sf ${varDir}/{conf,data} $out/
38 ln -sf ${varDir}/conf/.htaccess $out/
40 installPreloadPhase = ''
41 cp ${preloadFile []} $out/inc/preload.php
43 passthru = toPassthru package [];