summary refs log tree commit diff
path: root/nixos/modules/services/security/tor.nix
diff options
context:
space:
mode:
authorFelix Buehler <account@buehler.rocks>2023-06-25 11:47:43 +0200
committerAnderson Torres <torres.anderson.85@protonmail.com>2023-06-25 09:11:40 -0300
commit933a41a73fe2174b90cabb7d671ee2cc5658701a (patch)
tree1f8228d1369ab51c644a47ab269fb9c638553752 /nixos/modules/services/security/tor.nix
parent175e9d1f00c41b49606e4eacbc1bfe396641e90f (diff)
downloadnixpkgs-933a41a73fe2174b90cabb7d671ee2cc5658701a.tar
nixpkgs-933a41a73fe2174b90cabb7d671ee2cc5658701a.tar.gz
nixpkgs-933a41a73fe2174b90cabb7d671ee2cc5658701a.tar.bz2
nixpkgs-933a41a73fe2174b90cabb7d671ee2cc5658701a.tar.lz
nixpkgs-933a41a73fe2174b90cabb7d671ee2cc5658701a.tar.xz
nixpkgs-933a41a73fe2174b90cabb7d671ee2cc5658701a.tar.zst
nixpkgs-933a41a73fe2174b90cabb7d671ee2cc5658701a.zip
treewide: use optional instead of 'then []'
Diffstat (limited to 'nixos/modules/services/security/tor.nix')
-rw-r--r--nixos/modules/services/security/tor.nix5
1 files changed, 2 insertions, 3 deletions
diff --git a/nixos/modules/services/security/tor.nix b/nixos/modules/services/security/tor.nix
index 2aa2964f881..9e786eb2bf0 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