From 16dbd20852ff789f927c28317be014361a41b509 Mon Sep 17 00:00:00 2001 From: Zacchaeus Date: Sat, 12 Jul 2025 00:20:40 -0700 Subject: [PATCH] services: tor: add auto-start? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/services/networking.scm (tor-configuration): Add `auto-start?' field. Fix indent. * doc/guix.texi (tor-configuration): Document this. Change-Id: I9339291e3329d615550f97e9cc0f0d773f0d1c51 Reviewed-by: André Batista Signed-off-by: Sharlatan Hellseher --- doc/guix.texi | 3 +++ gnu/services/networking.scm | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index 10cd50b5fa1..fcd06edeaef 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -23231,6 +23231,9 @@ For any transport plugin you include in this list, appropriate configuration line to enable transport plugin will be automatically added to the default configuration file. +@item @code{auto-start?} (default: @code{#t}) +Whether or not to start the Tor daemon on boot. + @end table @end deftp diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index 52e37d20ab9..6dc4eb2b1b2 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -187,6 +187,7 @@ tor-configuration-socks-socket-type tor-configuration-control-socket-path tor-configuration-transport-plugins + tor-configuration-auto-start tor-onion-service-configuration tor-onion-service-configuration? tor-onion-service-configuration-name @@ -1171,7 +1172,9 @@ applications in communication. It is used by Jami, for example."))) (control-socket? tor-configuration-control-socket-path (default #f)) (transport-plugins tor-configuration-transport-plugins - (default '()))) + (default '())) + (auto-start? tor-configuration-auto-start + (default #t))) (define %tor-accounts ;; User account and groups for Tor. @@ -1284,6 +1287,7 @@ HiddenServicePort ~a ~a~%" "Return a running Tor." (let* ((torrc (tor-configuration->torrc config)) (transport-plugins (tor-configuration-transport-plugins config)) + (auto-start? (tor-configuration-auto-start config)) (tor (least-authority-wrapper (file-append (tor-configuration-tor config) "/bin/tor") #:name "tor" @@ -1320,6 +1324,7 @@ HiddenServicePort ~a ~a~%" (start #~(make-forkexec-constructor (list #$tor "-f" #$torrc) #:user "tor" #:group "tor")) + (auto-start? auto-start?) (stop #~(make-kill-destructor)) (actions (list (shepherd-configuration-action torrc))) (documentation "Run the Tor anonymous network overlay.")))))