diff options
author | Moritz 'e1mo' Fromm <git@e1mo.de> | 2023-01-06 00:14:43 +0100 |
---|---|---|
committer | Moritz 'e1mo' Fromm <git@e1mo.de> | 2023-01-06 23:52:49 +0100 |
commit | ee41b6b45713ccd327eedc3e50d5d58580571638 (patch) | |
tree | 1ea6a8831cd4394d0c933901444ef2a39e4a40d9 /pkgs/servers/web-apps | |
parent | cff8fd9c6cfefadd5ceea6717c03c66fdee235f8 (diff) |
dokuwiki: Combine mechanism for plugins and templates
Copy templates and plugins into Dokuwiki instead of linking to address template compatibility. As noted by @sinavir[^1], (some) templates would fail due to relative PHP imports. [^1]: https://github.com/NixOS/nixpkgs/pull/208299#issuecomment-1370413116
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; { |