X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=pkgs%2Fwebapps%2Fyourls%2Fdefault.nix;h=d940c54d1b505ebeeadb0b876c71b726775dda9d;hb=34c7b88e16d1768b1b9a0cfa6dd21ea5d9b1b308;hp=cc880cd96df0dd64c075f69b425496b4b77a77ed;hpb=b44b42a15197813060bf9405d5a07b8b2c699af5;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/pkgs/webapps/yourls/default.nix b/pkgs/webapps/yourls/default.nix index cc880cd..d940c54 100644 --- a/pkgs/webapps/yourls/default.nix +++ b/pkgs/webapps/yourls/default.nix @@ -1,14 +1,21 @@ -{ yourls_config ? "/etc/yourls/config.php", mylibs, stdenv }: +{ yourls_config ? "/etc/yourls/config.php", mylibs, callPackage, lib, stdenv }: let - withPlugins = plugins: package.overrideAttrs(old: { - name = "${old.name}-with-plugins"; - installPhase = old.installPhase + - builtins.concatStringsSep "\n" ( - map (value: "ln -s ${value} $out/user/plugins/${value.pluginName}") plugins - ); - passthru.plugins = plugins; - passthru.withPlugins = morePlugins: old.withPlugins (morePlugins ++ plugins); - }); + pluginNames = [ "ldap" ]; + allPlugins = lib.attrsets.genAttrs pluginNames + (name: callPackage (./plugins + "/${name}") { inherit mylibs; }); + toPassthru = pkg: plugins: { + inherit plugins allPlugins; + withPlugins = withPlugins pkg; + }; + withPlugins = pkg: toPlugins: + let + plugins = toPlugins allPlugins; + toInstallPlugin = n: "ln -s ${n} $out/user/plugins/${n.pluginName}"; + newYourls = pkg.overrideAttrs(old: { + installPhase = old.installPhase + "\n" + builtins.concatStringsSep "\n" (map toInstallPlugin plugins); + passthru = toPassthru newYourls (pkg.plugins ++ plugins); + }); + in newYourls; package = stdenv.mkDerivation (mylibs.fetchedGithub ./yourls.json // rec { installPhase = '' mkdir -p $out @@ -16,9 +23,6 @@ let cp sample-robots.txt $out/robots.txt ln -sf ${yourls_config} $out/includes/config.php ''; - passthru = { - plugins = []; - inherit withPlugins; - }; + passthru = toPassthru package []; }); in package