summary refs log tree commit diff
path: root/nixos/modules/services/security/tor.nix
diff options
context:
space:
mode:
authorAndrew R. M <nixy@nixy.moe>2020-08-30 13:15:43 -0400
committerAndrew R. M <nixy@nixy.moe>2020-08-30 14:35:36 -0400
commit168a9c8d3810a274e7c56c5eb3704766a5ced47e (patch)
tree3b982570670140dcacf4b78bf0a0343e9bae02eb /nixos/modules/services/security/tor.nix
parentc59ea8b8a0e7f927e7291c14ea6cd1bd3a16ff38 (diff)
downloadnixpkgs-168a9c8d3810a274e7c56c5eb3704766a5ced47e.tar
nixpkgs-168a9c8d3810a274e7c56c5eb3704766a5ced47e.tar.gz
nixpkgs-168a9c8d3810a274e7c56c5eb3704766a5ced47e.tar.bz2
nixpkgs-168a9c8d3810a274e7c56c5eb3704766a5ced47e.tar.lz
nixpkgs-168a9c8d3810a274e7c56c5eb3704766a5ced47e.tar.xz
nixpkgs-168a9c8d3810a274e7c56c5eb3704766a5ced47e.tar.zst
nixpkgs-168a9c8d3810a274e7c56c5eb3704766a5ced47e.zip
Add option to tor service for package
Diffstat (limited to 'nixos/modules/services/security/tor.nix')
-rw-r--r--nixos/modules/services/security/tor.nix20
1 files changed, 15 insertions, 5 deletions
diff --git a/nixos/modules/services/security/tor.nix b/nixos/modules/services/security/tor.nix
index b33e905c67d..b4bc2f694e4 100644
--- a/nixos/modules/services/security/tor.nix
+++ b/nixos/modules/services/security/tor.nix
@@ -34,8 +34,8 @@ let
     User tor
     DataDirectory ${torDirectory}
     ${optionalString cfg.enableGeoIP ''
-      GeoIPFile ${pkgs.tor.geoip}/share/tor/geoip
-      GeoIPv6File ${pkgs.tor.geoip}/share/tor/geoip6
+      GeoIPFile ${cfg.package.geoip}/share/tor/geoip
+      GeoIPv6File ${cfg.package.geoip}/share/tor/geoip6
     ''}
 
     ${optint "ControlPort" cfg.controlPort}
@@ -123,6 +123,16 @@ in
         '';
       };
 
+      package = mkOption {
+        type = types.package;
+        default = pkgs.tor;
+        defaultText = "pkgs.tor";
+        example = literalExample "pkgs.tor";
+        description = ''
+          Tor package to use
+        '';
+      };
+
       enableGeoIP = mkOption {
         type = types.bool;
         default = true;
@@ -749,8 +759,8 @@ in
         serviceConfig =
           { Type         = "simple";
             # Translated from the upstream contrib/dist/tor.service.in
-            ExecStartPre = "${pkgs.tor}/bin/tor -f ${torRcFile} --verify-config";
-            ExecStart    = "${pkgs.tor}/bin/tor -f ${torRcFile}";
+            ExecStartPre = "${cfg.package}/bin/tor -f ${torRcFile} --verify-config";
+            ExecStart    = "${cfg.package}/bin/tor -f ${torRcFile}";
             ExecReload   = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
             KillSignal   = "SIGINT";
             TimeoutSec   = 30;
@@ -773,7 +783,7 @@ in
           };
       };
 
-    environment.systemPackages = [ pkgs.tor ];
+    environment.systemPackages = [ cfg.package ];
 
     services.privoxy = mkIf (cfg.client.enable && cfg.client.privoxy.enable) {
       enable = true;