diff options
author | Ryan Lahfa <masterancpp@gmail.com> | 2023-01-18 00:51:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-18 00:51:18 +0100 |
commit | eb6d457115c5ca9b809d5bbe69a57d39110d29dc (patch) | |
tree | e3b3c66617a44a0b15785e9d2192107dbc101cc0 /pkgs/servers/web-apps | |
parent | 8db958d6de283241a123f4c7e1c47a1a794b8efd (diff) | |
parent | ee41b6b45713ccd327eedc3e50d5d58580571638 (diff) |
Merge pull request #209246 from e1mo/dokuwiki/package-overriding
dokuwiki: Combine mechanism for plugins and templates
Diffstat (limited to 'pkgs/servers/web-apps')
-rw-r--r-- | pkgs/servers/web-apps/dokuwiki/default.nix | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/pkgs/servers/web-apps/dokuwiki/default.nix b/pkgs/servers/web-apps/dokuwiki/default.nix index e77defae33ab4..b3a485113fa39 100644 --- a/pkgs/servers/web-apps/dokuwiki/default.nix +++ b/pkgs/servers/web-apps/dokuwiki/default.nix @@ -1,4 +1,10 @@ -{ lib, stdenv, fetchFromGitHub, writeText, nixosTests }: +{ lib +, stdenv +, fetchFromGitHub +, writeText +, nixosTests +, dokuwiki +}: stdenv.mkDerivation rec { pname = "dokuwiki"; @@ -38,15 +44,41 @@ stdenv.mkDerivation rec { ''; installPhase = '' + runHook preInstall + mkdir -p $out/share/dokuwiki cp -r * $out/share/dokuwiki cp ${preload} $out/share/dokuwiki/inc/preload.php cp ${phpLocalConfig} $out/share/dokuwiki/conf/local.php cp ${phpPluginsLocalConfig} $out/share/dokuwiki/conf/plugins.local.php + + runHook postInstall ''; - passthru.tests = { - inherit (nixosTests) dokuwiki; + passthru = { + combine = { basePackage ? dokuwiki + , plugins ? [] + , templates ? [] + , localConfig ? null + , pluginsConfig ? null + , aclConfig ? null + , pname ? (p: "${p.pname}-combined") + }: let + isNotEmpty = x: lib.optionalString (! builtins.elem x [ null "" ]); + in basePackage.overrideAttrs (prev: { + pname = if builtins.isFunction pname then pname prev else pname; + + postInstall = prev.postInstall or "" + '' + ${lib.concatMapStringsSep "\n" (tpl: "cp -r ${toString tpl} $out/share/dokuwiki/lib/tpl/${tpl.name}") templates} + ${lib.concatMapStringsSep "\n" (plugin: "cp -r ${toString plugin} $out/share/dokuwiki/lib/plugins/${plugin.name}") plugins} + ${isNotEmpty localConfig "ln -sf ${localConfig} $out/share/dokuwiki/conf/local.php" } + ${isNotEmpty pluginsConfig "ln -sf ${pluginsConfig} $out/share/dokuwiki/conf/plugins.local.php" } + ${isNotEmpty aclConfig "ln -sf ${aclConfig} $out/share/dokuwiki/acl.auth.php" } + ''; + }); + tests = { + inherit (nixosTests) dokuwiki; + }; }; meta = with lib; { |