2023-01-20 10:41:00 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, writeText
|
|
|
|
, nixosTests
|
|
|
|
, dokuwiki
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "dokuwiki";
|
2023-05-24 13:37:59 +00:00
|
|
|
version = "2023-04-04a";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2023-04-29 16:46:19 +00:00
|
|
|
owner = "dokuwiki";
|
2020-11-03 02:18:15 +00:00
|
|
|
repo = pname;
|
2023-04-29 16:46:19 +00:00
|
|
|
rev = "release-${version}";
|
2023-05-24 13:37:59 +00:00
|
|
|
sha256 = "sha256-PVfJfGYa2Drf4ljnnhb7kNpjfQlW4dDt5Xd5h+C8tP4=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
preload = writeText "preload.php" ''
|
|
|
|
<?php
|
|
|
|
|
|
|
|
$config_cascade = array(
|
|
|
|
'acl' => array(
|
|
|
|
'default' => getenv('DOKUWIKI_ACL_AUTH_CONFIG'),
|
|
|
|
),
|
|
|
|
'plainauth.users' => array(
|
|
|
|
'default' => getenv('DOKUWIKI_USERS_AUTH_CONFIG'),
|
|
|
|
'protected' => "" // not used by default
|
|
|
|
),
|
|
|
|
);
|
|
|
|
'';
|
|
|
|
|
|
|
|
phpLocalConfig = writeText "local.php" ''
|
|
|
|
<?php
|
|
|
|
return require(getenv('DOKUWIKI_LOCAL_CONFIG'));
|
|
|
|
?>
|
|
|
|
'';
|
|
|
|
|
|
|
|
phpPluginsLocalConfig = writeText "plugins.local.php" ''
|
|
|
|
<?php
|
|
|
|
return require(getenv('DOKUWIKI_PLUGINS_LOCAL_CONFIG'));
|
|
|
|
?>
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2023-01-20 10:41:00 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
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
|
2023-01-20 10:41:00 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
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;
|
|
|
|
};
|
2021-12-19 01:06:50 +00:00
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Simple to use and highly versatile Open Source wiki software that doesn't require a database";
|
|
|
|
license = licenses.gpl2;
|
|
|
|
homepage = "https://www.dokuwiki.org";
|
|
|
|
platforms = platforms.all;
|
2020-08-20 17:08:02 +00:00
|
|
|
maintainers = with maintainers; [ _1000101 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|