]>
Commit | Line | Data |
---|---|---|
34c7b88e | 1 | { yourls_config ? "/etc/yourls/config.php", mylibs, callPackage, lib, stdenv }: |
b44b42a1 | 2 | let |
34c7b88e IB |
3 | pluginNames = [ "ldap" ]; |
4 | allPlugins = lib.attrsets.genAttrs pluginNames | |
5 | (name: callPackage (./plugins + "/${name}") { inherit mylibs; }); | |
6 | toPassthru = pkg: plugins: { | |
7 | inherit plugins allPlugins; | |
8 | withPlugins = withPlugins pkg; | |
9 | }; | |
10 | withPlugins = pkg: toPlugins: | |
11 | let | |
12 | plugins = toPlugins allPlugins; | |
13 | toInstallPlugin = n: "ln -s ${n} $out/user/plugins/${n.pluginName}"; | |
14 | newYourls = pkg.overrideAttrs(old: { | |
15 | installPhase = old.installPhase + "\n" + builtins.concatStringsSep "\n" (map toInstallPlugin plugins); | |
16 | passthru = toPassthru newYourls (pkg.plugins ++ plugins); | |
17 | }); | |
18 | in newYourls; | |
b44b42a1 IB |
19 | package = stdenv.mkDerivation (mylibs.fetchedGithub ./yourls.json // rec { |
20 | installPhase = '' | |
21 | mkdir -p $out | |
22 | cp -a */ *.php $out/ | |
23 | cp sample-robots.txt $out/robots.txt | |
24 | ln -sf ${yourls_config} $out/includes/config.php | |
25 | ''; | |
34c7b88e | 26 | passthru = toPassthru package []; |
b44b42a1 IB |
27 | }); |
28 | in package |