X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=flakes%2Fmypackages%2Fpkgs%2Fwebapps%2Fyourls%2Fdefault.nix;h=8001a606ef94c84c52ab5625de157bd818337c94;hb=776aa3603903616702b8bc1d9e955d3a6da9ee1e;hpb=c7b16397101fd534c41ede5ae7c55e7e120c06f7;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/flakes/mypackages/pkgs/webapps/yourls/default.nix b/flakes/mypackages/pkgs/webapps/yourls/default.nix new file mode 100644 index 0000000..8001a60 --- /dev/null +++ b/flakes/mypackages/pkgs/webapps/yourls/default.nix @@ -0,0 +1,37 @@ +{ yourls_config ? "/etc/yourls/config.php", fetchFromGitHub, callPackage, lib, stdenv }: +let + pluginNames = [ "ldap" ]; + allPlugins = lib.attrsets.genAttrs pluginNames + (name: callPackage (./plugins + "/${name}") {}); + 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 (rec { + pname = "yourls"; + version = "1.7.3"; + src = fetchFromGitHub { + owner = "YOURLS"; + repo = "YOURLS"; + rev = "077018822d3594229daa8343310d0b40804b9ddc"; + sha256 = "1av6h619rwqn0yn0kjn2s2h3gmrhmxaaa9hd5ns4ralxgg731imd"; + fetchSubmodules = true; + }; + installPhase = '' + mkdir -p $out + cp -a */ *.php $out/ + cp sample-robots.txt $out/robots.txt + ln -sf ${yourls_config} $out/includes/config.php + ''; + passthru = toPassthru package []; + }); +in package