Merge pull request #96686 from nixy/add/tor-package-option
tor: Add option to tor service for package
This commit is contained in:
commit
6716867eb3
1 changed files with 15 additions and 5 deletions
|
@ -34,8 +34,8 @@ let
|
||||||
User tor
|
User tor
|
||||||
DataDirectory ${torDirectory}
|
DataDirectory ${torDirectory}
|
||||||
${optionalString cfg.enableGeoIP ''
|
${optionalString cfg.enableGeoIP ''
|
||||||
GeoIPFile ${pkgs.tor.geoip}/share/tor/geoip
|
GeoIPFile ${cfg.package.geoip}/share/tor/geoip
|
||||||
GeoIPv6File ${pkgs.tor.geoip}/share/tor/geoip6
|
GeoIPv6File ${cfg.package.geoip}/share/tor/geoip6
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optint "ControlPort" cfg.controlPort}
|
${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 {
|
enableGeoIP = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
|
@ -749,8 +759,8 @@ in
|
||||||
serviceConfig =
|
serviceConfig =
|
||||||
{ Type = "simple";
|
{ Type = "simple";
|
||||||
# Translated from the upstream contrib/dist/tor.service.in
|
# Translated from the upstream contrib/dist/tor.service.in
|
||||||
ExecStartPre = "${pkgs.tor}/bin/tor -f ${torRcFile} --verify-config";
|
ExecStartPre = "${cfg.package}/bin/tor -f ${torRcFile} --verify-config";
|
||||||
ExecStart = "${pkgs.tor}/bin/tor -f ${torRcFile}";
|
ExecStart = "${cfg.package}/bin/tor -f ${torRcFile}";
|
||||||
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
||||||
KillSignal = "SIGINT";
|
KillSignal = "SIGINT";
|
||||||
TimeoutSec = 30;
|
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) {
|
services.privoxy = mkIf (cfg.client.enable && cfg.client.privoxy.enable) {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
Loading…
Reference in a new issue