diff options
author | dadada <dadada@dadada.li> | 2020-03-30 13:08:16 +0200 |
---|---|---|
committer | dadada <dadada@dadada.li> | 2020-04-18 23:37:18 +0200 |
commit | af6a7a04869889b470c4dad6e0adc57482818d3a (patch) | |
tree | ea1a6f972c0e61788e83ee963d505e333886ec49 /nixos/modules/services | |
parent | 71baf4801c6918bcbac976bd68e502d89d90ddfc (diff) | |
download | nixlib-af6a7a04869889b470c4dad6e0adc57482818d3a.tar nixlib-af6a7a04869889b470c4dad6e0adc57482818d3a.tar.gz nixlib-af6a7a04869889b470c4dad6e0adc57482818d3a.tar.bz2 nixlib-af6a7a04869889b470c4dad6e0adc57482818d3a.tar.lz nixlib-af6a7a04869889b470c4dad6e0adc57482818d3a.tar.xz nixlib-af6a7a04869889b470c4dad6e0adc57482818d3a.tar.zst nixlib-af6a7a04869889b470c4dad6e0adc57482818d3a.zip |
nixos/dokuwiki: add plugins and templates options
Adds support for additional plugins and templates similarly to how wordpress.nix does it. Plugins and templates need to be packaged as in the example.
Diffstat (limited to 'nixos/modules/services')
-rw-r--r-- | nixos/modules/services/web-apps/dokuwiki.nix | 61 |
1 files changed, 60 insertions, 1 deletions
diff --git a/nixos/modules/services/web-apps/dokuwiki.nix b/nixos/modules/services/web-apps/dokuwiki.nix index 6378cf6507c4..7587c744ad51 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. + <note><para>These plugins need to be packaged before use, see example.</para></note> + ''; + 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. + <note><para>These templates need to be packaged before use, see example.</para></note> + ''; + 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 = { |