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
This commit is contained in:
parent
cff8fd9c6c
commit
ee41b6b457
@ -73,28 +73,16 @@ let
|
||||
${if isString pc then pc else pc_gen pc}
|
||||
'';
|
||||
|
||||
pkg = hostName: cfg: pkgs.stdenv.mkDerivation rec {
|
||||
pname = "dokuwiki-${hostName}";
|
||||
version = src.version;
|
||||
src = cfg.package;
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -r * $out/
|
||||
pkg = hostName: cfg: cfg.package.combine {
|
||||
inherit (cfg) plugins templates;
|
||||
|
||||
# symlink the dokuwiki config
|
||||
ln -sf ${dokuwikiLocalConfig hostName cfg} $out/share/dokuwiki/conf/local.php
|
||||
pname = p: "${p.pname}-${hostName}";
|
||||
|
||||
# symlink plugins config
|
||||
ln -sf ${dokuwikiPluginsLocalConfig hostName cfg} $out/share/dokuwiki/conf/plugins.local.php
|
||||
|
||||
# symlink acl (if needed)
|
||||
${optionalString (cfg.mergedConfig.useacl && cfg.acl != null) "ln -sf ${dokuwikiAclAuthConfig hostName cfg} $out/share/dokuwiki/acl.auth.php"}
|
||||
|
||||
# symlink additional plugin(s) and templates(s)
|
||||
${concatMapStringsSep "\n" (template: "ln -sf ${template} $out/share/dokuwiki/lib/tpl/${template.name}") cfg.templates}
|
||||
${concatMapStringsSep "\n" (plugin: "ln -sf ${plugin} $out/share/dokuwiki/lib/plugins/${plugin.name}") cfg.plugins}
|
||||
'';
|
||||
basePackage = cfg.package;
|
||||
localConfig = dokuwikiLocalConfig hostName cfg;
|
||||
pluginsConfig = dokuwikiPluginsLocalConfig hostName cfg;
|
||||
aclConfig = if cfg.aclUse && cfg.acl != null then dokuwikiAclAuthConfig hostName cfg else null;
|
||||
};
|
||||
|
||||
aclOpts = { ... }: {
|
||||
|
@ -142,6 +142,14 @@ in {
|
||||
"curl -sSfL 'http://site2.local/doku.php?id=plugin-list' | (! grep 'plugin:tag')",
|
||||
)
|
||||
|
||||
# Test if theme is applied and working correctly (no weired relative PHP import errors)
|
||||
machine.succeed(
|
||||
"curl -sSfL 'http://site1.local/doku.php' | grep 'bootstrap3/images/logo.png'",
|
||||
"curl -sSfL 'http://site1.local/lib/exe/css.php' | grep 'bootstrap3'",
|
||||
"curl -sSfL 'http://site1.local/lib/tpl/bootstrap3/css.php'",
|
||||
)
|
||||
|
||||
|
||||
# Just to ensure both Webserver configurations are consistent in allowing that
|
||||
with subtest("Rewriting"):
|
||||
machine.succeed(
|
||||
|
@ -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; {
|
||||
|
Loading…
Reference in New Issue
Block a user