mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 19:55:41 +03:00
nixos/stalwart-mail: fix incorrect config for webadmin and spam-filter
Stalwart 0.11.0 changed the `config.resource.spam-filter` and `config.resource.webadmin` keys to be `spam-filter.resource` and `webadmin.resource` respectively. The NixOS has been updated accordingly, but unfortunately it has mistakenly used `config.spam-filter.resource` and `config.webadmin.resource`, which are incorrect and do not do anything. This commit changes the default configuration to use the correct keys. Note that due to infinite recursion, the `optionalAttrs` has been replaced with `mkIf`. Additionally, some tests were added to catch this regression in the future. Fixes #411351
This commit is contained in:
parent
d1c235f033
commit
b7ab1fa981
2 changed files with 20 additions and 15 deletions
|
@ -107,21 +107,17 @@ in
|
|||
resolver.public-suffix = lib.mkDefault [
|
||||
"file://${pkgs.publicsuffix-list}/share/publicsuffix/public_suffix_list.dat"
|
||||
];
|
||||
config = {
|
||||
spam-filter.resource = lib.mkDefault "file://${cfg.package}/etc/stalwart/spamfilter.toml";
|
||||
webadmin =
|
||||
let
|
||||
hasHttpListener = builtins.any (listener: listener.protocol == "http") (
|
||||
lib.attrValues cfg.settings.server.listener
|
||||
);
|
||||
in
|
||||
{
|
||||
path = "/var/cache/stalwart-mail";
|
||||
}
|
||||
// lib.optionalAttrs ((builtins.hasAttr "listener" cfg.settings.server) && hasHttpListener) {
|
||||
resource = lib.mkDefault "file://${cfg.package.webadmin}/webadmin.zip";
|
||||
};
|
||||
};
|
||||
spam-filter.resource = lib.mkDefault "file://${cfg.package}/etc/stalwart/spamfilter.toml";
|
||||
webadmin =
|
||||
let
|
||||
hasHttpListener = builtins.any (listener: listener.protocol == "http") (
|
||||
lib.attrValues (cfg.settings.server.listener or { })
|
||||
);
|
||||
in
|
||||
{
|
||||
path = "/var/cache/stalwart-mail";
|
||||
resource = lib.mkIf (hasHttpListener) (lib.mkDefault "file://${cfg.package.webadmin}/webadmin.zip");
|
||||
};
|
||||
};
|
||||
|
||||
# This service stores a potentially large amount of data.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue