]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - pkgs/webapps/yourls/default.nix
cc880cd96df0dd64c075f69b425496b4b77a77ed
[perso/Immae/Config/Nix.git] / pkgs / webapps / yourls / default.nix
1 { yourls_config ? "/etc/yourls/config.php", mylibs, stdenv }:
2 let
3 withPlugins = plugins: package.overrideAttrs(old: {
4 name = "${old.name}-with-plugins";
5 installPhase = old.installPhase +
6 builtins.concatStringsSep "\n" (
7 map (value: "ln -s ${value} $out/user/plugins/${value.pluginName}") plugins
8 );
9 passthru.plugins = plugins;
10 passthru.withPlugins = morePlugins: old.withPlugins (morePlugins ++ plugins);
11 });
12 package = stdenv.mkDerivation (mylibs.fetchedGithub ./yourls.json // rec {
13 installPhase = ''
14 mkdir -p $out
15 cp -a */ *.php $out/
16 cp sample-robots.txt $out/robots.txt
17 ln -sf ${yourls_config} $out/includes/config.php
18 '';
19 passthru = {
20 plugins = [];
21 inherit withPlugins;
22 };
23 });
24 in package