From 933a41a73fe2174b90cabb7d671ee2cc5658701a Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Sun, 25 Jun 2023 11:47:43 +0200 Subject: treewide: use optional instead of 'then []' --- nixos/modules/services/security/tor.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'nixos/modules/services/security') diff --git a/nixos/modules/services/security/tor.nix b/nixos/modules/services/security/tor.nix index 2aa2964f8818..9e786eb2bf06 100644 --- a/nixos/modules/services/security/tor.nix +++ b/nixos/modules/services/security/tor.nix @@ -769,7 +769,7 @@ in }; options.SOCKSPort = mkOption { description = lib.mdDoc (descriptionGeneric "SOCKSPort"); - default = if cfg.settings.HiddenServiceNonAnonymousMode == true then [{port = 0;}] else []; + default = lib.optionals cfg.settings.HiddenServiceNonAnonymousMode [{port = 0;}]; defaultText = literalExpression '' if config.${opt.settings}.HiddenServiceNonAnonymousMode == true then [ { port = 0; } ] @@ -897,8 +897,7 @@ in allowedTCPPorts = concatMap (o: if isInt o && o > 0 then [o] - else if o ? "port" && isInt o.port && o.port > 0 then [o.port] - else [] + else optionals (o ? "port" && isInt o.port && o.port > 0) [o.port] ) (flatten [ cfg.settings.ORPort cfg.settings.DirPort -- cgit 1.4.1