Update dokuwiki service config
This commit is contained in:
parent
76424262ec
commit
b7c8b28cf9
1 changed files with 77 additions and 129 deletions
|
@ -13,57 +13,6 @@
|
||||||
fpm_cfg = config.services.phpfpm.pools.${fpm_pool};
|
fpm_cfg = config.services.phpfpm.pools.${fpm_pool};
|
||||||
dw_domain = "wiki.${baseDomain}";
|
dw_domain = "wiki.${baseDomain}";
|
||||||
|
|
||||||
# Comming from Nextcloud module
|
|
||||||
# Using opcache to cache the php-files in a precompiled state and thus better performance
|
|
||||||
phpOptions = {
|
|
||||||
expose_php = "Off";
|
|
||||||
"opcache.interned_strings_buffer" = "8";
|
|
||||||
"opcache.max_accelerated_files" = "10000";
|
|
||||||
"opcache.memory_consumption" = "64";
|
|
||||||
"opcache.revalidate_freq" = "15";
|
|
||||||
"opcache.fast_shutdown" = "1";
|
|
||||||
};
|
|
||||||
phpPackage = pkgs.php81.buildEnv {
|
|
||||||
extraConfig = toKeyValue phpOptions;
|
|
||||||
};
|
|
||||||
toKeyValue = with lib;
|
|
||||||
generators.toKeyValue {
|
|
||||||
mkKeyValue = generators.mkKeyValueDefault {} " = ";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Taken
|
|
||||||
mkPHPValue = v: let
|
|
||||||
isHasAttr = s: isAttrs v && hasAttr s v;
|
|
||||||
in
|
|
||||||
if isString v
|
|
||||||
then escapeShellArg v
|
|
||||||
# NOTE: If any value contains a , (comma) this will not get escaped
|
|
||||||
else if isList v && any lib.strings.isCoercibleToString v
|
|
||||||
then escapeShellArg (concatMapStringsSep "," toString v)
|
|
||||||
else if isInt v
|
|
||||||
then toString v
|
|
||||||
else if isBool v
|
|
||||||
then toString (if v then 1 else 0)
|
|
||||||
else if isHasAttr "_file"
|
|
||||||
then "trim(file_get_contents(${lib.escapeShellArg v._file}))"
|
|
||||||
else abort "The dokuwiki settings value ${lib.generators.toPretty {} v} can not be encoded.";
|
|
||||||
|
|
||||||
# Present until https://github.com/NixOS/nixpkgs/pull/208299 is merged
|
|
||||||
# so we can still use RFC42-Style settings in the meantime
|
|
||||||
mkPHPAttrVals = v: flatten (mapAttrsToList mkPHPKeyVal v);
|
|
||||||
mkPHPKeyVal = k: v: let
|
|
||||||
values =
|
|
||||||
if (isAttrs v && hasAttr "_file" v) || !isAttrs v
|
|
||||||
then [" = ${mkPHPValue v};"]
|
|
||||||
else mkPHPAttrVals v;
|
|
||||||
in
|
|
||||||
map (e: "[${escapeShellArg k}]${e}") (flatten values);
|
|
||||||
mkConfigLines = c: map (v: "$conf${v}") (mkPHPAttrVals c);
|
|
||||||
|
|
||||||
dokuwikiLocalConfig = settings: ''
|
|
||||||
${concatStringsSep "\n" (mkConfigLines settings)}
|
|
||||||
'';
|
|
||||||
|
|
||||||
acronyms = rec {
|
acronyms = rec {
|
||||||
"CCC" = "Chaos Computer Club";
|
"CCC" = "Chaos Computer Club";
|
||||||
"PR" = "Pull Request";
|
"PR" = "Pull Request";
|
||||||
|
@ -105,8 +54,6 @@ in {
|
||||||
locations."/robots.txt".return = "200 \"User-agent: *\nDisallow: /\"";
|
locations."/robots.txt".return = "200 \"User-agent: *\nDisallow: /\"";
|
||||||
};
|
};
|
||||||
|
|
||||||
services.phpfpm.pools.${fpm_pool}.phpPackage = lib.mkForce phpPackage;
|
|
||||||
|
|
||||||
services.dokuwiki.sites.${dw_domain} = {
|
services.dokuwiki.sites.${dw_domain} = {
|
||||||
package = pkgs.dokuwiki.overrideAttrs (oldAttrs: {
|
package = pkgs.dokuwiki.overrideAttrs (oldAttrs: {
|
||||||
name = "dokuwiki-${dw_domain}-with-acronyms-${oldAttrs.version}";
|
name = "dokuwiki-${dw_domain}-with-acronyms-${oldAttrs.version}";
|
||||||
|
@ -116,35 +63,29 @@ in {
|
||||||
});
|
});
|
||||||
|
|
||||||
enable = true;
|
enable = true;
|
||||||
aclUse = true;
|
|
||||||
|
|
||||||
pluginsConfig = let
|
pluginsConfig = {
|
||||||
plugins = {
|
"tag" = true;
|
||||||
"tag" = true;
|
"pagelist" = true;
|
||||||
"pagelist" = true;
|
"smtp" = true;
|
||||||
"smtp" = true;
|
"sqlite" = true;
|
||||||
"sqlite" = true;
|
"nspages" = true;
|
||||||
"nspages" = true;
|
"move" = true;
|
||||||
"move" = true;
|
"icalevents" = true;
|
||||||
"icalevents" = true;
|
"legalnotice" = true;
|
||||||
"legalnotice" = true;
|
"oauth" = true;
|
||||||
"oauth" = true;
|
"oauthkeycloak" = true;
|
||||||
"oauthkeycloak" = true;
|
"edittable" = true;
|
||||||
"edittable" = true;
|
"anonip" = true;
|
||||||
"anonip" = true;
|
|
||||||
|
|
||||||
"extension" = false;
|
"extension" = false;
|
||||||
"popularity" = false;
|
"popularity" = false;
|
||||||
"authad" = false;
|
"authad" = false;
|
||||||
"authldap" = false;
|
"authldap" = false;
|
||||||
"authmysql" = false;
|
"authmysql" = false;
|
||||||
"authpdo" = false;
|
"authpdo" = false;
|
||||||
"authpgsql" = false;
|
"authpgsql" = false;
|
||||||
};
|
};
|
||||||
in ''
|
|
||||||
# Placeholder until https://github.com/NixOS/nixpkgs/pull/208299 is merged
|
|
||||||
${concatStringsSep "\n" (mapAttrsToList (n: v: "$plugins['${n}'] = ${boolToString v};") plugins)};
|
|
||||||
'';
|
|
||||||
|
|
||||||
plugins = with pkgs.dokuwikiPlugins; [
|
plugins = with pkgs.dokuwikiPlugins; [
|
||||||
tag
|
tag
|
||||||
|
@ -159,57 +100,64 @@ in {
|
||||||
anonip
|
anonip
|
||||||
];
|
];
|
||||||
|
|
||||||
extraConfig = let
|
settings = let
|
||||||
get_secret = name: {_file = config.sops.secrets.${name}.path;};
|
get_secret = name: {_file = config.sops.secrets.${name}.path;};
|
||||||
settings = rec {
|
in rec {
|
||||||
title = "${baseDomain} Wiki";
|
title = "${baseDomain} Wiki";
|
||||||
lang = "de-informal";
|
lang = "de-informal";
|
||||||
template = "dokuwiki";
|
template = "dokuwiki";
|
||||||
# authtype = "authplain";
|
# authtype = "authplain";
|
||||||
authtype = "oauth";
|
authtype = "oauth";
|
||||||
subscribers = 1;
|
subscribers = 1;
|
||||||
userewrite = 1;
|
userewrite = 1;
|
||||||
useslash = 1;
|
useslash = 1;
|
||||||
im_convert = "${pkgs.imagemagick}/bin/convert";
|
useacl = true;
|
||||||
superuser = "@admin";
|
im_convert = "${pkgs.imagemagick}/bin/convert";
|
||||||
disableactions = "register";
|
superuser = "@admin";
|
||||||
signature = "--- // [[name:@USER@|@USER@]] @DATE@";
|
disableactions = "register";
|
||||||
|
signature = "--- // [[name:@USER@|@USER@]] @DATE@";
|
||||||
|
|
||||||
mailfrom = "\"@USER@\" via ${title} <wiki@chaos.jetzt>}";
|
mailfrom = "\"@USER@\" via ${title} <wiki@chaos.jetzt>}";
|
||||||
plugin.tag.toolbar_icon = 1;
|
plugin.tag.toolbar_icon = 1;
|
||||||
plugin.smtp = {
|
plugin.smtp = {
|
||||||
smtp_host = get_secret "dokuwiki/smtp_host";
|
smtp_host = get_secret "dokuwiki/smtp_host";
|
||||||
smtp_user = get_secret "dokuwiki/smtp_host";
|
smtp_user = get_secret "dokuwiki/smtp_host";
|
||||||
smtp_pass = get_secret "dokuwiki/smtp_host";
|
smtp_pass = get_secret "dokuwiki/smtp_host";
|
||||||
smtp_ssl = "ssl";
|
smtp_ssl = "ssl";
|
||||||
smtp_port = 465;
|
smtp_port = 465;
|
||||||
};
|
|
||||||
plugin.icalevents = {
|
|
||||||
locationUrlPrefix = "";
|
|
||||||
"template:default" = ''
|
|
||||||
=== {date}: {summary} ===
|
|
||||||
**Location**: {location_link}
|
|
||||||
{description}'';
|
|
||||||
"template:list" = ''
|
|
||||||
=== {date}: {summary} ===
|
|
||||||
**<sup>Location: {location}</sup>**
|
|
||||||
{description}'';
|
|
||||||
"template:custom1" = ''
|
|
||||||
=== {date}: {summary} ===
|
|
||||||
{description}
|
|
||||||
**Wo?**: {location_link}'';
|
|
||||||
};
|
|
||||||
plugin.oauth = {
|
|
||||||
register-on-auth = 1;
|
|
||||||
singleService = "Keycloak";
|
|
||||||
};
|
|
||||||
plugin.oauthkeycloak = {
|
|
||||||
key = get_secret "dokuwiki/keycloak_key";
|
|
||||||
openidurl = "https://sso.chaos.jetzt/auth/realms/chaos-jetzt/.well-known/openid-configuration";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
in ''
|
plugin.icalevents = {
|
||||||
${dokuwikiLocalConfig settings}
|
locationUrlPrefix = "";
|
||||||
'';
|
"template:default" = ''
|
||||||
|
=== {date}: {summary} ===
|
||||||
|
**Location**: {location_link}
|
||||||
|
{description}'';
|
||||||
|
"template:list" = ''
|
||||||
|
=== {date}: {summary} ===
|
||||||
|
**<sup>Location: {location}</sup>**
|
||||||
|
{description}'';
|
||||||
|
"template:custom1" = ''
|
||||||
|
=== {date}: {summary} ===
|
||||||
|
{description}
|
||||||
|
**Wo?**: {location_link}'';
|
||||||
|
};
|
||||||
|
plugin.oauth = {
|
||||||
|
register-on-auth = 1;
|
||||||
|
singleService = "Keycloak";
|
||||||
|
};
|
||||||
|
plugin.oauthkeycloak = {
|
||||||
|
key = get_secret "dokuwiki/keycloak_key";
|
||||||
|
openidurl = "https://sso.chaos.jetzt/auth/realms/chaos-jetzt/.well-known/openid-configuration";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
phpOptions = {
|
||||||
|
expose_php = "Off";
|
||||||
|
"opcache.interned_strings_buffer" = "8";
|
||||||
|
"opcache.max_accelerated_files" = "10000";
|
||||||
|
"opcache.memory_consumption" = "64";
|
||||||
|
"opcache.revalidate_freq" = "15";
|
||||||
|
"opcache.fast_shutdown" = "1";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue