]>
Commit | Line | Data |
---|---|---|
1a64deeb | 1 | { yourls_config ? "/etc/yourls/config.php", fetchFromGitHub, callPackage, lib, stdenv }: |
b44b42a1 | 2 | let |
34c7b88e IB |
3 | pluginNames = [ "ldap" ]; |
4 | allPlugins = lib.attrsets.genAttrs pluginNames | |
1a64deeb | 5 | (name: callPackage (./plugins + "/${name}") {}); |
34c7b88e IB |
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; | |
1a64deeb IB |
19 | package = stdenv.mkDerivation (rec { |
20 | pname = "yourls"; | |
21 | version = "1.7.3"; | |
22 | src = fetchFromGitHub { | |
23 | owner = "YOURLS"; | |
24 | repo = "YOURLS"; | |
25 | rev = "077018822d3594229daa8343310d0b40804b9ddc"; | |
26 | sha256 = "1av6h619rwqn0yn0kjn2s2h3gmrhmxaaa9hd5ns4ralxgg731imd"; | |
27 | fetchSubmodules = true; | |
28 | }; | |
b44b42a1 IB |
29 | installPhase = '' |
30 | mkdir -p $out | |
31 | cp -a */ *.php $out/ | |
32 | cp sample-robots.txt $out/robots.txt | |
33 | ln -sf ${yourls_config} $out/includes/config.php | |
34 | ''; | |
34c7b88e | 35 | passthru = toPassthru package []; |
b44b42a1 IB |
36 | }); |
37 | in package |