about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorFelix Buehler <account@buehler.rocks>2023-06-04 14:20:51 +0200
committerFelix Buehler <account@buehler.rocks>2023-06-06 22:54:31 +0200
commited3b102d1e51fe69d73dac210719e3a75f69fa85 (patch)
treeb3f5e8513913f0be81dd916ba9cd4bad8956a8a9 /nixos
parentf47f0a525cac079318e62fef27439f17afa18e7a (diff)
downloadnixlib-ed3b102d1e51fe69d73dac210719e3a75f69fa85.tar
nixlib-ed3b102d1e51fe69d73dac210719e3a75f69fa85.tar.gz
nixlib-ed3b102d1e51fe69d73dac210719e3a75f69fa85.tar.bz2
nixlib-ed3b102d1e51fe69d73dac210719e3a75f69fa85.tar.lz
nixlib-ed3b102d1e51fe69d73dac210719e3a75f69fa85.tar.xz
nixlib-ed3b102d1e51fe69d73dac210719e3a75f69fa85.tar.zst
nixlib-ed3b102d1e51fe69d73dac210719e3a75f69fa85.zip
treewide: use use lib.optionalAttrs instead of 'then {}'
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/continuous-integration/buildkite-agents.nix2
-rw-r--r--nixos/modules/services/mail/rspamd.nix2
-rw-r--r--nixos/modules/services/web-apps/mattermost.nix3
3 files changed, 3 insertions, 4 deletions
diff --git a/nixos/modules/services/continuous-integration/buildkite-agents.nix b/nixos/modules/services/continuous-integration/buildkite-agents.nix
index 7c8f77580ff6..a40b939a16c7 100644
--- a/nixos/modules/services/continuous-integration/buildkite-agents.nix
+++ b/nixos/modules/services/continuous-integration/buildkite-agents.nix
@@ -11,7 +11,7 @@ let
       default = null;
       description = lib.mdDoc description;
       type = types.nullOr types.lines;
-    } // (if example == null then {} else { inherit example; });
+    } // (lib.optionalAttrs (example != null) { inherit example; });
   };
   mkHookOptions = hooks: listToAttrs (map mkHookOption hooks);
 
diff --git a/nixos/modules/services/mail/rspamd.nix b/nixos/modules/services/mail/rspamd.nix
index f9be9024dd4f..ca88d8122179 100644
--- a/nixos/modules/services/mail/rspamd.nix
+++ b/nixos/modules/services/mail/rspamd.nix
@@ -215,7 +215,7 @@ let
       text = v.extraConfig;
     })
     (filterAttrs (n: v: v.extraConfig != "") cfg.workers))
-    // (if cfg.extraConfig == "" then {} else {
+    // (lib.optionalAttrs (cfg.extraConfig != "") {
       "extra-config.inc".text = cfg.extraConfig;
     });
 in
diff --git a/nixos/modules/services/web-apps/mattermost.nix b/nixos/modules/services/web-apps/mattermost.nix
index db5122e79f00..66e5f1695a15 100644
--- a/nixos/modules/services/web-apps/mattermost.nix
+++ b/nixos/modules/services/web-apps/mattermost.nix
@@ -86,8 +86,7 @@ let
   mattermostConf = recursiveUpdate
     mattermostConfWithoutPlugins
     (
-      if mattermostPlugins == null then {}
-      else {
+      lib.optionalAttrs (mattermostPlugins != null) {
         PluginSettings = {
           Enable = true;
         };