From c7497cd5f6d3cd0d750bd4ba1884a5f89b53d851 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Sun, 15 Jun 2025 03:28:48 +0200 Subject: [PATCH] treewide: remove redundant parenthesis in nix code --- default.nix | 4 ++-- mail-server/dovecot.nix | 4 ++-- mail-server/postfix.nix | 18 +++++++++--------- mail-server/rspamd.nix | 4 ++-- mail-server/users.nix | 10 +++++----- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/default.nix b/default.nix index afe77b8..fa471bf 100644 --- a/default.nix +++ b/default.nix @@ -517,7 +517,7 @@ in type = let loginAccount = mkOptionType { 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)); example = { @@ -901,7 +901,7 @@ in }; domain = mkOption { - type = types.enum (cfg.domains); + type = types.enum cfg.domains; example = "example.com"; description = '' The domain from which outgoing DMARC reports are served. diff --git a/mail-server/dovecot.nix b/mail-server/dovecot.nix index c06b478..c6e5587 100644 --- a/mail-server/dovecot.nix +++ b/mail-server/dovecot.nix @@ -148,7 +148,7 @@ in ]; warnings = - (lib.optional ( + lib.optional ( (builtins.length cfg.fullTextSearch.languages > 1) && (builtins.elem "stopwords" cfg.fullTextSearch.filters) ) '' @@ -158,7 +158,7 @@ in The recommended solution is to NOT use the stopword filter when multiple languages are present in the configuration. - '') + '' ; # for sieve-test. Shelling it in on demand usually doesnt' work, as it reads diff --git a/mail-server/postfix.nix b/mail-server/postfix.nix index e45a725..9fb316f 100644 --- a/mail-server/postfix.nix +++ b/mail-server/postfix.nix @@ -75,23 +75,23 @@ let in builtins.toFile "regex_valias" content; # denied_recipients_postfix :: [ String ] - denied_recipients_postfix = (map + denied_recipients_postfix = map (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); - reject_senders_postfix = (map + reject_senders_postfix = map (sender: "${sender} REJECT") - (cfg.rejectSender)); - reject_senders_file = builtins.toFile "reject_senders" (lib.concatStringsSep "\n" (reject_senders_postfix)) ; + cfg.rejectSender; + reject_senders_file = builtins.toFile "reject_senders" (lib.concatStringsSep "\n" reject_senders_postfix) ; - reject_recipients_postfix = (map + reject_recipients_postfix = map (recipient: "${recipient} REJECT") - (cfg.rejectRecipients)); + cfg.rejectRecipients; # 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 = builtins.toFile "vhosts" (concatStringsSep "\n" cfg.domains); @@ -231,7 +231,7 @@ in virtual_mailbox_domains = vhosts_file; virtual_mailbox_maps = [ (mappedFile "valias") - ] ++ lib.optionals (cfg.ldap.enable) [ + ] ++ lib.optionals cfg.ldap.enable [ "ldap:${ldapVirtualMailboxMapFile}" ] ++ lib.optionals (regex_valiases_postfix != {}) [ (mappedRegexFile "regex_valias") diff --git a/mail-server/rspamd.nix b/mail-server/rspamd.nix index 0e37c20..ab5113a 100644 --- a/mail-server/rspamd.nix +++ b/mail-server/rspamd.nix @@ -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 # default behaviour when called without a date. # 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"; wantedBy = [ "timers.target" diff --git a/mail-server/users.nix b/mail-server/users.nix index 17196fc..bf654c3 100644 --- a/mail-server/users.nix +++ b/mail-server/users.nix @@ -70,17 +70,17 @@ let in { config = lib.mkIf enable { # assert that all accounts provide a password - assertions = (map (acct: { - assertion = (acct.hashedPassword != null || acct.hashedPasswordFile != null); + assertions = map (acct: { + assertion = acct.hashedPassword != null || acct.hashedPasswordFile != null; 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 - warnings = (map + warnings = map (acct: "${acct.name} specifies both a password hash and hash file; hash file will be used") (lib.filter (acct: (acct.hashedPassword != null && acct.hashedPasswordFile != null)) - (lib.attrValues loginAccounts))); + (lib.attrValues loginAccounts)); # set the vmail gid to a specific value users.groups = {