aboutsummaryrefslogtreecommitdiff
path: root/pkgs/webapps/yourls/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/webapps/yourls/default.nix')
-rw-r--r--pkgs/webapps/yourls/default.nix34
1 files changed, 18 insertions, 16 deletions
diff --git a/pkgs/webapps/yourls/default.nix b/pkgs/webapps/yourls/default.nix
index 4bcfa4c..d940c54 100644
--- a/pkgs/webapps/yourls/default.nix
+++ b/pkgs/webapps/yourls/default.nix
@@ -1,16 +1,21 @@
1{ yourls_config ? "/etc/yourls/config.php", mylibs, stdenv }: 1{ yourls_config ? "/etc/yourls/config.php", mylibs, callPackage, lib, stdenv }:
2let 2let
3 withPlugins = plugins: package.overrideAttrs(old: { 3 pluginNames = [ "ldap" ];
4 name = "${old.name}-with-plugins"; 4 allPlugins = lib.attrsets.genAttrs pluginNames
5 installPhase = old.installPhase + 5 (name: callPackage (./plugins + "/${name}") { inherit mylibs; });
6 builtins.concatStringsSep "\n" ( 6 toPassthru = pkg: plugins: {
7 map (value: "ln -s ${value} $out/user/plugins/${value.pluginName}") plugins 7 inherit plugins allPlugins;
8 ); 8 withPlugins = withPlugins pkg;
9 passthru = old.passthru // { 9 };
10 inherit plugins; 10 withPlugins = pkg: toPlugins:
11 withPlugins = morePlugins: old.withPlugins (morePlugins ++ plugins); 11 let
12 }; 12 plugins = toPlugins allPlugins;
13 }); 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;
14 package = stdenv.mkDerivation (mylibs.fetchedGithub ./yourls.json // rec { 19 package = stdenv.mkDerivation (mylibs.fetchedGithub ./yourls.json // rec {
15 installPhase = '' 20 installPhase = ''
16 mkdir -p $out 21 mkdir -p $out
@@ -18,9 +23,6 @@ let
18 cp sample-robots.txt $out/robots.txt 23 cp sample-robots.txt $out/robots.txt
19 ln -sf ${yourls_config} $out/includes/config.php 24 ln -sf ${yourls_config} $out/includes/config.php
20 ''; 25 '';
21 passthru = { 26 passthru = toPassthru package [];
22 plugins = [];
23 inherit withPlugins;
24 };
25 }); 27 });
26in package 28in package