treewide: remove redundant parenthesis in nix code

This commit is contained in:
Martin Weinelt 2025-06-15 03:28:48 +02:00
parent 5f592b5960
commit c7497cd5f6
No known key found for this signature in database
GPG key ID: 87C1E9888F856759
5 changed files with 20 additions and 20 deletions

View file

@ -517,7 +517,7 @@ in
type = let type = let
loginAccount = mkOptionType { loginAccount = mkOptionType {
name = "Login Account"; name = "Login Account";
check = (account: builtins.elem account (builtins.attrNames cfg.loginAccounts)); check = account: builtins.elem account (builtins.attrNames cfg.loginAccounts);
}; };
in with types; attrsOf (either loginAccount (nonEmptyListOf loginAccount)); in with types; attrsOf (either loginAccount (nonEmptyListOf loginAccount));
example = { example = {
@ -901,7 +901,7 @@ in
}; };
domain = mkOption { domain = mkOption {
type = types.enum (cfg.domains); type = types.enum cfg.domains;
example = "example.com"; example = "example.com";
description = '' description = ''
The domain from which outgoing DMARC reports are served. The domain from which outgoing DMARC reports are served.

View file

@ -148,7 +148,7 @@ in
]; ];
warnings = warnings =
(lib.optional ( lib.optional (
(builtins.length cfg.fullTextSearch.languages > 1) && (builtins.length cfg.fullTextSearch.languages > 1) &&
(builtins.elem "stopwords" cfg.fullTextSearch.filters) (builtins.elem "stopwords" cfg.fullTextSearch.filters)
) '' ) ''
@ -158,7 +158,7 @@ in
The recommended solution is to NOT use the stopword filter when The recommended solution is to NOT use the stopword filter when
multiple languages are present in the configuration. multiple languages are present in the configuration.
'') ''
; ;
# for sieve-test. Shelling it in on demand usually doesnt' work, as it reads # for sieve-test. Shelling it in on demand usually doesnt' work, as it reads

View file

@ -75,23 +75,23 @@ let
in builtins.toFile "regex_valias" content; in builtins.toFile "regex_valias" content;
# denied_recipients_postfix :: [ String ] # denied_recipients_postfix :: [ String ]
denied_recipients_postfix = (map denied_recipients_postfix = map
(acct: "${acct.name} REJECT ${acct.sendOnlyRejectMessage}") (acct: "${acct.name} REJECT ${acct.sendOnlyRejectMessage}")
(lib.filter (acct: acct.sendOnly) (lib.attrValues cfg.loginAccounts))); (lib.filter (acct: acct.sendOnly) (lib.attrValues cfg.loginAccounts));
denied_recipients_file = builtins.toFile "denied_recipients" (lib.concatStringsSep "\n" denied_recipients_postfix); denied_recipients_file = builtins.toFile "denied_recipients" (lib.concatStringsSep "\n" denied_recipients_postfix);
reject_senders_postfix = (map reject_senders_postfix = map
(sender: (sender:
"${sender} REJECT") "${sender} REJECT")
(cfg.rejectSender)); cfg.rejectSender;
reject_senders_file = builtins.toFile "reject_senders" (lib.concatStringsSep "\n" (reject_senders_postfix)) ; reject_senders_file = builtins.toFile "reject_senders" (lib.concatStringsSep "\n" reject_senders_postfix) ;
reject_recipients_postfix = (map reject_recipients_postfix = map
(recipient: (recipient:
"${recipient} REJECT") "${recipient} REJECT")
(cfg.rejectRecipients)); cfg.rejectRecipients;
# rejectRecipients :: [ Path ] # rejectRecipients :: [ Path ]
reject_recipients_file = builtins.toFile "reject_recipients" (lib.concatStringsSep "\n" (reject_recipients_postfix)) ; reject_recipients_file = builtins.toFile "reject_recipients" (lib.concatStringsSep "\n" reject_recipients_postfix) ;
# vhosts_file :: Path # vhosts_file :: Path
vhosts_file = builtins.toFile "vhosts" (concatStringsSep "\n" cfg.domains); vhosts_file = builtins.toFile "vhosts" (concatStringsSep "\n" cfg.domains);
@ -231,7 +231,7 @@ in
virtual_mailbox_domains = vhosts_file; virtual_mailbox_domains = vhosts_file;
virtual_mailbox_maps = [ virtual_mailbox_maps = [
(mappedFile "valias") (mappedFile "valias")
] ++ lib.optionals (cfg.ldap.enable) [ ] ++ lib.optionals cfg.ldap.enable [
"ldap:${ldapVirtualMailboxMapFile}" "ldap:${ldapVirtualMailboxMapFile}"
] ++ lib.optionals (regex_valiases_postfix != {}) [ ] ++ lib.optionals (regex_valiases_postfix != {}) [
(mappedRegexFile "regex_valias") (mappedRegexFile "regex_valias")

View file

@ -171,7 +171,7 @@ in
]; ];
}; };
systemd.services.rspamd-dmarc-reporter = lib.optionalAttrs (cfg.dmarcReporting.enable) { systemd.services.rspamd-dmarc-reporter = lib.optionalAttrs cfg.dmarcReporting.enable {
# Explicitly select yesterday's date to work around broken # Explicitly select yesterday's date to work around broken
# default behaviour when called without a date. # default behaviour when called without a date.
# https://github.com/rspamd/rspamd/issues/4062 # https://github.com/rspamd/rspamd/issues/4062
@ -216,7 +216,7 @@ in
}; };
}; };
systemd.timers.rspamd-dmarc-reporter = lib.optionalAttrs (cfg.dmarcReporting.enable) { systemd.timers.rspamd-dmarc-reporter = lib.optionalAttrs cfg.dmarcReporting.enable {
description = "Daily delivery of aggregated DMARC reports"; description = "Daily delivery of aggregated DMARC reports";
wantedBy = [ wantedBy = [
"timers.target" "timers.target"

View file

@ -70,17 +70,17 @@ let
in { in {
config = lib.mkIf enable { config = lib.mkIf enable {
# assert that all accounts provide a password # assert that all accounts provide a password
assertions = (map (acct: { assertions = map (acct: {
assertion = (acct.hashedPassword != null || acct.hashedPasswordFile != null); assertion = acct.hashedPassword != null || acct.hashedPasswordFile != null;
message = "${acct.name} must provide either a hashed password or a password hash file"; message = "${acct.name} must provide either a hashed password or a password hash file";
}) (lib.attrValues loginAccounts)); }) (lib.attrValues loginAccounts);
# warn for accounts that specify both password and file # warn for accounts that specify both password and file
warnings = (map warnings = map
(acct: "${acct.name} specifies both a password hash and hash file; hash file will be used") (acct: "${acct.name} specifies both a password hash and hash file; hash file will be used")
(lib.filter (lib.filter
(acct: (acct.hashedPassword != null && acct.hashedPasswordFile != null)) (acct: (acct.hashedPassword != null && acct.hashedPasswordFile != null))
(lib.attrValues loginAccounts))); (lib.attrValues loginAccounts));
# set the vmail gid to a specific value # set the vmail gid to a specific value
users.groups = { users.groups = {