mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 04:35:41 +03:00
nixos/dokuwiki: Finally remove extraConfig
After the introduction of structured settings in #208299 the old string-style options / types which were kept for compatibility are now removed in preparation for the 23.05 release.
This commit is contained in:
parent
d550ee0d43
commit
e78f08fa21
2 changed files with 68 additions and 59 deletions
|
@ -279,9 +279,10 @@ In addition to numerous new and upgraded packages, this release has the followin
|
||||||
`services.dnsmasq.extraConfig` will be deprecated when NixOS 22.11 reaches
|
`services.dnsmasq.extraConfig` will be deprecated when NixOS 22.11 reaches
|
||||||
end of life.
|
end of life.
|
||||||
|
|
||||||
- The `dokuwiki` service now takes configuration via the `services.dokuwiki.sites.<name>.settings` attribute set, `extraConfig` is deprecated and will be removed.
|
- The `dokuwiki` service is now configured via `services.dokuwiki.sites.<name>.settings` attribute set; `extraConfig` has been removed.
|
||||||
The `{aclUse,superUser,disableActions}` attributes have been renamed, `pluginsConfig` now also accepts an attribute set of booleans, passing plain PHP is deprecated.
|
The `{aclUse,superUser,disableActions}` attributes have been renamed accordingly. `pluginsConfig` now only accepts an attribute set of booleans.
|
||||||
Same applies to `acl` which now also accepts structured settings.
|
Passing plain PHP is no longer possible.
|
||||||
|
Same applies to `acl` which now also only accepts structured `settings`.
|
||||||
|
|
||||||
- The `zsh` package changes the way to set environment variables on NixOS systems where `programs.zsh.enable` equals `false`. It now sources `/etc/set-environment` when reading the system-level `zshenv` file. Before, it sourced `/etc/profile` when reading the system-level `zprofile` file.
|
- The `zsh` package changes the way to set environment variables on NixOS systems where `programs.zsh.enable` equals `false`. It now sources `/etc/set-environment` when reading the system-level `zshenv` file. Before, it sourced `/etc/profile` when reading the system-level `zprofile` file.
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
inherit (lib.options) showOption showFiles;
|
||||||
|
|
||||||
cfg = config.services.dokuwiki;
|
cfg = config.services.dokuwiki;
|
||||||
eachSite = cfg.sites;
|
eachSite = cfg.sites;
|
||||||
user = "dokuwiki";
|
user = "dokuwiki";
|
||||||
|
@ -63,7 +65,6 @@ let
|
||||||
conf_gen = c: map (v: "$conf${v}") (mkPhpAttrVals c);
|
conf_gen = c: map (v: "$conf${v}") (mkPhpAttrVals c);
|
||||||
in writePhpFile "local-${hostName}.php" ''
|
in writePhpFile "local-${hostName}.php" ''
|
||||||
${concatStringsSep "\n" (conf_gen cfg.mergedConfig)}
|
${concatStringsSep "\n" (conf_gen cfg.mergedConfig)}
|
||||||
${toString cfg.extraConfig}
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
dokuwikiPluginsLocalConfig = hostName: cfg: let
|
dokuwikiPluginsLocalConfig = hostName: cfg: let
|
||||||
|
@ -118,32 +119,63 @@ let
|
||||||
'';
|
'';
|
||||||
example = "read";
|
example = "read";
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
siteOpts = { config, lib, name, ... }:
|
# The current implementations of `doRename`, `mkRenamedOptionModule` do not provide the full options path when used with submodules.
|
||||||
|
# They would only show `settings.useacl' instead of `services.dokuwiki.sites."site1.local".settings.useacl'
|
||||||
|
# The partial re-implementation of these functions is done to help users in debugging by showing the full path.
|
||||||
|
mkRenamed = from: to: { config, options, name, ... }: let
|
||||||
|
pathPrefix = [ "services" "dokuwiki" "sites" name ];
|
||||||
|
fromPath = pathPrefix ++ from;
|
||||||
|
fromOpt = getAttrFromPath from options;
|
||||||
|
toOp = getAttrsFromPath to config;
|
||||||
|
toPath = pathPrefix ++ to;
|
||||||
|
in {
|
||||||
|
options = setAttrByPath from (mkOption {
|
||||||
|
visible = false;
|
||||||
|
description = lib.mdDoc "Alias of {option}${showOption toPath}";
|
||||||
|
apply = x: builtins.trace "Obsolete option `${showOption fromPath}' is used. It was renamed to ${showOption toPath}" toOp;
|
||||||
|
});
|
||||||
|
config = mkMerge [
|
||||||
|
{
|
||||||
|
warnings = optional fromOpt.isDefined
|
||||||
|
"The option `${showOption fromPath}' defined in ${showFiles fromOpt.files} has been renamed to `${showOption toPath}'.";
|
||||||
|
}
|
||||||
|
(lib.modules.mkAliasAndWrapDefsWithPriority (setAttrByPath to) fromOpt)
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
siteOpts = { options, config, lib, name, ... }:
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
# NOTE: These will sadly not print the absolute argument path but only the name. Related to #96006
|
(mkRenamed [ "aclUse" ] [ "settings" "useacl" ])
|
||||||
(mkRenamedOptionModule [ "aclUse" ] [ "settings" "useacl" ] )
|
(mkRenamed [ "superUser" ] [ "settings" "superuser" ])
|
||||||
(mkRenamedOptionModule [ "superUser" ] [ "settings" "superuser" ] )
|
(mkRenamed [ "disableActions" ] [ "settings" "disableactions" ])
|
||||||
(mkRenamedOptionModule [ "disableActions" ] [ "settings" "disableactions" ] )
|
({ config, options, ... }: let
|
||||||
({ config, options, name, ...}: {
|
showPath = suffix: lib.options.showOption ([ "services" "dokuwiki" "sites" name ] ++ suffix);
|
||||||
config.warnings =
|
replaceExtraConfig = "Please use `${showPath ["settings"]}' to pass structured settings instead.";
|
||||||
(optional (isString config.pluginsConfig) ''
|
ecOpt = options.extraConfig;
|
||||||
Passing plain strings to services.dokuwiki.sites.${name}.pluginsConfig has been deprecated and will not be continue to be supported in the future.
|
ecPath = showPath [ "extraConfig" ];
|
||||||
Please pass structured settings instead.
|
in {
|
||||||
'')
|
options.extraConfig = mkOption {
|
||||||
++ (optional (isString config.acl) ''
|
visible = false;
|
||||||
Passing a plain string to services.dokuwiki.sites.${name}.acl has been deprecated and will not continue to be supported in the future.
|
apply = x: throw "The option ${ecPath} can no longer be used since it's been removed.\n${replaceExtraConfig}";
|
||||||
Please pass structured settings instead.
|
};
|
||||||
'')
|
config.assertions = [
|
||||||
++ (optional (config.extraConfig != null) ''
|
{
|
||||||
services.dokuwiki.sites.${name}.extraConfig is deprecated and will be removed in the future.
|
assertion = !ecOpt.isDefined;
|
||||||
Please pass structured settings to services.dokuwiki.sites.${name}.settings instead.
|
message = "The option definition `${ecPath}' in ${showFiles ecOpt.files} no longer has any effect; please remove it.\n${replaceExtraConfig}";
|
||||||
'')
|
}
|
||||||
;
|
{
|
||||||
|
assertion = config.mergedConfig.useacl -> (config.acl != null || config.aclFile != null);
|
||||||
|
message = "Either ${showPath [ "acl" ]} or ${showPath [ "aclFile" ]} is mandatory if ${showPath [ "settings" "useacl" ]} is true";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
assertion = config.usersFile != null -> config.mergedConfig.useacl != false;
|
||||||
|
message = "${showPath [ "settings" "useacl" ]} is required when ${showPath [ "usersFile" ]} is set (Currently defiend as `${config.usersFile}' in ${showFiles options.usersFile.files}).";
|
||||||
|
}
|
||||||
|
];
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -164,7 +196,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
acl = mkOption {
|
acl = mkOption {
|
||||||
type = with types; nullOr (oneOf [ lines (listOf (submodule aclOpts)) ]);
|
type = with types; nullOr (listOf (submodule aclOpts));
|
||||||
default = null;
|
default = null;
|
||||||
example = literalExpression ''
|
example = literalExpression ''
|
||||||
[
|
[
|
||||||
|
@ -203,7 +235,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
pluginsConfig = mkOption {
|
pluginsConfig = mkOption {
|
||||||
type = with types; oneOf [lines (attrsOf bool)];
|
type = with types; attrsOf bool;
|
||||||
default = {
|
default = {
|
||||||
authad = false;
|
authad = false;
|
||||||
authldap = false;
|
authldap = false;
|
||||||
|
@ -370,36 +402,21 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfig = mkOption {
|
|
||||||
# This Option is deprecated and only kept until sometime before 23.05 for compatibility reasons
|
|
||||||
# FIXME (@e1mo): Actually remember removing this before 23.05.
|
|
||||||
visible = false;
|
|
||||||
type = types.nullOr types.lines;
|
|
||||||
default = null;
|
|
||||||
example = ''
|
|
||||||
$conf['title'] = 'My Wiki';
|
|
||||||
$conf['userewrite'] = 1;
|
|
||||||
'';
|
|
||||||
description = lib.mdDoc ''
|
|
||||||
DokuWiki configuration. Refer to
|
|
||||||
<https://www.dokuwiki.org/config>
|
|
||||||
for details on supported values.
|
|
||||||
|
|
||||||
**Note**: Please pass Structured settings via
|
|
||||||
`services.dokuwiki.sites.${name}.settings` instead.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
# Required for the mkRenamedOptionModule
|
# Required for the mkRenamedOptionModule
|
||||||
# TODO: Remove me once https://github.com/NixOS/nixpkgs/issues/96006 is fixed
|
# TODO: Remove me once https://github.com/NixOS/nixpkgs/issues/96006 is fixed
|
||||||
# or the aclUse, ... options are removed.
|
# or we don't have any more notes about the removal of extraConfig, ...
|
||||||
warnings = mkOption {
|
warnings = mkOption {
|
||||||
type = types.listOf types.unspecified;
|
type = types.listOf types.unspecified;
|
||||||
default = [ ];
|
default = [ ];
|
||||||
visible = false;
|
visible = false;
|
||||||
internal = true;
|
internal = true;
|
||||||
};
|
};
|
||||||
|
assertions = mkOption {
|
||||||
|
type = types.listOf types.unspecified;
|
||||||
|
default = [ ];
|
||||||
|
visible = false;
|
||||||
|
internal = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
@ -435,16 +452,7 @@ in
|
||||||
|
|
||||||
warnings = flatten (mapAttrsToList (_: cfg: cfg.warnings) eachSite);
|
warnings = flatten (mapAttrsToList (_: cfg: cfg.warnings) eachSite);
|
||||||
|
|
||||||
assertions = flatten (mapAttrsToList (hostName: cfg:
|
assertions = flatten (mapAttrsToList (_: cfg: cfg.assertions) eachSite);
|
||||||
[{
|
|
||||||
assertion = cfg.mergedConfig.useacl -> (cfg.acl != null || cfg.aclFile != null);
|
|
||||||
message = "Either services.dokuwiki.sites.${hostName}.acl or services.dokuwiki.sites.${hostName}.aclFile is mandatory if settings.useacl is true";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
assertion = cfg.usersFile != null -> cfg.mergedConfig.useacl != false;
|
|
||||||
message = "services.dokuwiki.sites.${hostName}.settings.useacl must must be true if usersFile is not null";
|
|
||||||
}
|
|
||||||
]) eachSite);
|
|
||||||
|
|
||||||
services.phpfpm.pools = mapAttrs' (hostName: cfg: (
|
services.phpfpm.pools = mapAttrs' (hostName: cfg: (
|
||||||
nameValuePair "dokuwiki-${hostName}" {
|
nameValuePair "dokuwiki-${hostName}" {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue