]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - pkgs/webapps/dokuwiki/default.nix
Replace fetchgitPrivate by its builtins counterpart
[perso/Immae/Config/Nix.git] / pkgs / webapps / dokuwiki / default.nix
CommitLineData
c9d13ae3
IB
1{ varDir ? "/var/lib/dokuwiki", preload ? "", lib, stdenv, mylibs, writeText }:
2let
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 '';
e6abbae2
IB
19 passthru = old.passthru // {
20 inherit plugins;
21 withPlugins = morePlugins: old.withPlugins (morePlugins ++ plugins);
22 };
c9d13ae3
IB
23 });
24 package = stdenv.mkDerivation (mylibs.fetchedGithub ./dokuwiki.json // rec {
25 phases = "unpackPhase buildPhase installPhase installPreloadPhase fixupPhase";
26 buildPhase = ''
27 mv conf conf.dist
28 mv data data.dist
29 '';
30 installPhase = ''
31 cp -a . $out
32 ln -sf ${varDir}/{conf,data} $out/
33 ln -sf ${varDir}/conf/.htaccess $out/
34 '';
35 installPreloadPhase = ''
36 cp ${preloadFile []} $out/inc/preload.php
37 '';
38 passthru = {
39 plugins = [];
40 inherit withPlugins varDir;
41 };
42 });
43in package