]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - flakes/mypackages/pkgs/webapps/yourls/default.nix
Switch to colemna
[perso/Immae/Config/Nix.git] / flakes / mypackages / pkgs / webapps / yourls / default.nix
1 { yourls_config ? "/etc/yourls/config.php", fetchFromGitHub, callPackage, lib, stdenv }:
2 let
3 pluginNames = [ "ldap" ];
4 allPlugins = lib.attrsets.genAttrs pluginNames
5 (name: callPackage (./plugins + "/${name}") {});
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;
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 };
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 '';
35 passthru = toPassthru package [];
36 });
37 in package