Skip to content

Commit 3fc7e20

Browse files
dokuwiki: add extraConfigs to combine (#479174)
2 parents dddfd1a + 8b4f523 commit 3fc7e20

File tree

3 files changed

+30
-10
lines changed

3 files changed

+30
-10
lines changed

nixos/modules/services/web-apps/dokuwiki.nix

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ let
115115
pkg =
116116
hostName: cfg:
117117
cfg.package.combine {
118-
inherit (cfg) plugins templates;
118+
inherit (cfg) plugins templates extraConfigs;
119119

120120
pname = p: "${p.pname}-${hostName}";
121121

@@ -345,6 +345,22 @@ let
345345
'';
346346
};
347347

348+
extraConfigs = mkOption {
349+
type = types.attrsOf types.path;
350+
default = { };
351+
description = ''
352+
Path(s) to additional configuration files that are then linked to the 'conf' directory.
353+
'';
354+
example = literalExpression ''
355+
{
356+
"acronyms.local.conf" = pkgs.writeText "acronyms.local.conf" '''
357+
r13y reproducibility
358+
''';
359+
"entities.local.conf" = ./dokuwiki-entities;
360+
}
361+
'';
362+
};
363+
348364
poolConfig = mkOption {
349365
type =
350366
with types;

nixos/tests/dokuwiki.nix

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ let
3030
r13y reproducibility
3131
'';
3232

33-
dwWithAcronyms = pkgs.dokuwiki.overrideAttrs (prev: {
34-
installPhase = prev.installPhase or "" + ''
35-
ln -sf ${acronymsFile} $out/share/dokuwiki/conf/acronyms.local.conf
36-
'';
37-
});
38-
3933
mkNode =
4034
webserver:
4135
{ ... }:
@@ -53,9 +47,11 @@ let
5347
};
5448
};
5549
"site2.local" = {
56-
package = dwWithAcronyms;
5750
usersFile = "/var/lib/dokuwiki/site2.local/users.auth.php";
5851
plugins = [ plugin-icalevents ];
52+
extraConfigs = {
53+
"acronyms.local.conf" = acronymsFile;
54+
};
5955
settings = {
6056
useacl = true;
6157
superuser = "admin";

pkgs/by-name/do/dokuwiki/package.nix

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ stdenv.mkDerivation rec {
6565
localConfig ? null,
6666
pluginsConfig ? null,
6767
aclConfig ? null,
68+
extraConfigs ? { },
6869
pname ? (p: "${p.pname}-combined"),
6970
}:
7071
let
@@ -76,6 +77,12 @@ stdenv.mkDerivation rec {
7677
""
7778
]
7879
);
80+
81+
configs = {
82+
"local.php" = localConfig;
83+
"plugins.local.php" = pluginsConfig;
84+
}
85+
// extraConfigs;
7986
in
8087
basePackage.overrideAttrs (prev: {
8188
pname = if builtins.isFunction pname then pname prev else pname;
@@ -87,8 +94,9 @@ stdenv.mkDerivation rec {
8794
${lib.concatMapStringsSep "\n" (
8895
plugin: "cp -r ${toString plugin} $out/share/dokuwiki/lib/plugins/${plugin.name}"
8996
) plugins}
90-
${isNotEmpty localConfig "ln -sf ${localConfig} $out/share/dokuwiki/conf/local.php"}
91-
${isNotEmpty pluginsConfig "ln -sf ${pluginsConfig} $out/share/dokuwiki/conf/plugins.local.php"}
97+
${lib.concatMapAttrsStringSep "\n" (
98+
name: path: "${isNotEmpty path "ln -sf ${path} $out/share/dokuwiki/conf/${name}"}"
99+
) configs}
92100
${isNotEmpty aclConfig "ln -sf ${aclConfig} $out/share/dokuwiki/acl.auth.php"}
93101
'';
94102
});

0 commit comments

Comments
 (0)