summary refs log tree commit diff
path: root/nixos/modules/services/security/tor.nix
diff options
context:
space:
mode:
authorpennae <github@quasiparticle.net>2021-12-05 21:45:35 +0100
committerpennae <github@quasiparticle.net>2021-12-09 01:14:16 +0100
commited673a69dbf5f9be67183621eb0f5c1759d48299 (patch)
treec5c2aa29c87a0f517e66f805d593fc74deb6ae79 /nixos/modules/services/security/tor.nix
parentfb0e5be84331188a69b3edd31679ca6576edb75a (diff)
downloadnixpkgs-ed673a69dbf5f9be67183621eb0f5c1759d48299.tar
nixpkgs-ed673a69dbf5f9be67183621eb0f5c1759d48299.tar.gz
nixpkgs-ed673a69dbf5f9be67183621eb0f5c1759d48299.tar.bz2
nixpkgs-ed673a69dbf5f9be67183621eb0f5c1759d48299.tar.lz
nixpkgs-ed673a69dbf5f9be67183621eb0f5c1759d48299.tar.xz
nixpkgs-ed673a69dbf5f9be67183621eb0f5c1759d48299.tar.zst
nixpkgs-ed673a69dbf5f9be67183621eb0f5c1759d48299.zip
treewide: add defaultText for options with simple cfg.* expression defaults
adds defaultText for options with defaults that use only literals, full config.*
paths, and the cfg shortcut binding.
Diffstat (limited to 'nixos/modules/services/security/tor.nix')
-rw-r--r--nixos/modules/services/security/tor.nix8
1 files changed, 7 insertions, 1 deletions
diff --git a/nixos/modules/services/security/tor.nix b/nixos/modules/services/security/tor.nix
index c3e3248ee8a..f3ed1d160ee 100644
--- a/nixos/modules/services/security/tor.nix
+++ b/nixos/modules/services/security/tor.nix
@@ -1,10 +1,11 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
 
 with builtins;
 with lib;
 
 let
   cfg = config.services.tor;
+  opt = options.services.tor;
   stateDir = "/var/lib/tor";
   runDir = "/run/tor";
   descriptionGeneric = option: ''
@@ -799,6 +800,11 @@ in
           options.SOCKSPort = mkOption {
             description = descriptionGeneric "SOCKSPort";
             default = if cfg.settings.HiddenServiceNonAnonymousMode == true then [{port = 0;}] else [];
+            defaultText = literalExpression ''
+              if config.${opt.settings}.HiddenServiceNonAnonymousMode == true
+              then [ { port = 0; } ]
+              else [ ]
+            '';
             example = [{port = 9090;}];
             type = types.listOf (optionSOCKSPort true);
           };