diff --git a/nixos/modules/services/web-apps/dokuwiki.nix b/nixos/modules/services/web-apps/dokuwiki.nix
index 6378cf6507c..7587c744ad5 100644
--- a/nixos/modules/services/web-apps/dokuwiki.nix
+++ b/nixos/modules/services/web-apps/dokuwiki.nix
@@ -3,7 +3,7 @@
let
inherit (lib) mkEnableOption mkForce mkIf mkMerge mkOption optionalAttrs recursiveUpdate types;
- inherit (lib) flatten mapAttrs mapAttrs' mapAttrsToList nameValuePair;
+ inherit (lib) concatMapStringsSep flatten mapAttrs mapAttrs' mapAttrsToList nameValuePair concatMapStringSep;
eachSite = config.services.dokuwiki;
stateDir = cfg: "/var/lib/dokuwiki/${cfg.hostName}";
@@ -50,6 +50,10 @@ let
# symlink acl
ln -s ${dokuwikiAclAuthConfig cfg} $out/share/dokuwiki/acl.auth.php
+
+ # symlink additional plugin(s) and templates(s)
+ ${concatMapStringsSep "\n" (template: "ln -s ${template} $out/share/dokuwiki/lib/tpl/${template.name}") cfg.templates}
+ ${concatMapStringsSep "\n" (plugin: "ln -s ${plugin} $out/share/dokuwiki/lib/plugins/${plugin.name}") cfg.plugins}
'';
};
@@ -155,6 +159,61 @@ let
'';
};
+ plugins = mkOption {
+ type = types.listOf types.path;
+ default = [];
+ description = ''
+ List of path(s) to respective plugin(s) which are copied from the 'plugin' directory.
+ These plugins need to be packaged before use, see example.
+ '';
+ example = ''
+ # Let's package the icalevents plugin
+ plugin-icalevents = pkgs.stdenv.mkDerivation {
+ name = "icalevents";
+ # Download the plugin from the dokuwiki site
+ src = pkgs.fetchurl {
+ url = https://github.com/real-or-random/dokuwiki-plugin-icalevents/releases/download/2017-06-16/dokuwiki-plugin-icalevents-2017-06-16.zip;
+ sha256 = "e40ed7dd6bbe7fe3363bbbecb4de481d5e42385b5a0f62f6a6ce6bf3a1f9dfa8";
+ };
+ sourceRoot = ".";
+ # We need unzip to build this package
+ buildInputs = [ pkgs.unzip ];
+ # Installing simply means copying all files to the output directory
+ installPhase = "mkdir -p $out; cp -R * $out/";
+ };
+
+ # And then pass this theme to the plugin list like this:
+ plugins = [ plugin-icalevents ];
+ '';
+ };
+
+ templates = mkOption {
+ type = types.listOf types.path;
+ default = [];
+ description = ''
+ List of path(s) to respective template(s) which are copied from the 'tpl' directory.
+ These templates need to be packaged before use, see example.
+ '';
+ example = ''
+ # Let's package the bootstrap3 theme
+ template-bootstrap3 = pkgs.stdenv.mkDerivation {
+ name = "bootstrap3";
+ # Download the theme from the dokuwiki site
+ src = pkgs.fetchurl {
+ url = https://github.com/giterlizzi/dokuwiki-template-bootstrap3/archive/v2019-05-22.zip;
+ sha256 = "4de5ff31d54dd61bbccaf092c9e74c1af3a4c53e07aa59f60457a8f00cfb23a6";
+ };
+ # We need unzip to build this package
+ buildInputs = [ pkgs.unzip ];
+ # Installing simply means copying all files to the output directory
+ installPhase = "mkdir -p $out; cp -R * $out/";
+ };
+
+ # And then pass this theme to the template list like this:
+ templates = [ template-bootstrap3 ];
+ '';
+ };
+
poolConfig = mkOption {
type = with types; attrsOf (oneOf [ str int bool ]);
default = {
diff --git a/nixos/tests/dokuwiki.nix b/nixos/tests/dokuwiki.nix
index 65d2677dd3a..62d8ec9f0b1 100644
--- a/nixos/tests/dokuwiki.nix
+++ b/nixos/tests/dokuwiki.nix
@@ -1,13 +1,43 @@
import ./make-test-python.nix ({ pkgs, ... }:
-{
+let
+ template-bootstrap3 = pkgs.stdenv.mkDerivation {
+ name = "bootstrap3";
+ # Download the theme from the dokuwiki site
+ src = pkgs.fetchurl {
+ url = https://github.com/giterlizzi/dokuwiki-template-bootstrap3/archive/v2019-05-22.zip;
+ sha256 = "4de5ff31d54dd61bbccaf092c9e74c1af3a4c53e07aa59f60457a8f00cfb23a6";
+ };
+ # We need unzip to build this package
+ buildInputs = [ pkgs.unzip ];
+ # Installing simply means copying all files to the output directory
+ installPhase = "mkdir -p $out; cp -R * $out/";
+ };
+
+
+ # Let's package the icalevents plugin
+ plugin-icalevents = pkgs.stdenv.mkDerivation {
+ name = "icalevents";
+ # Download the plugin from the dokuwiki site
+ src = pkgs.fetchurl {
+ url = https://github.com/real-or-random/dokuwiki-plugin-icalevents/releases/download/2017-06-16/dokuwiki-plugin-icalevents-2017-06-16.zip;
+ sha256 = "e40ed7dd6bbe7fe3363bbbecb4de481d5e42385b5a0f62f6a6ce6bf3a1f9dfa8";
+ };
+ # We need unzip to build this package
+ buildInputs = [ pkgs.unzip ];
+ sourceRoot = ".";
+ # Installing simply means copying all files to the output directory
+ installPhase = "mkdir -p $out; cp -R * $out/";
+ };
+
+in {
name = "dokuwiki";
meta.maintainers = with pkgs.lib.maintainers; [ "1000101" ];
machine = { ... }: {
services.dokuwiki."site1.local" = {
acl = " ";
- superUser = null;
+ superUser = "admin";
nginx = {
forceSSL = false;
enableACME = false;
@@ -15,11 +45,13 @@ import ./make-test-python.nix ({ pkgs, ... }:
};
services.dokuwiki."site2.local" = {
acl = " ";
- superUser = null;
+ superUser = "admin";
nginx = {
forceSSL = false;
enableACME = false;
};
+ templates = [ template-bootstrap3 ];
+ plugins = [ plugin-icalevents ];
};
networking.hosts."127.0.0.1" = [ "site1.local" "site2.local" ];
};