services: tor: add auto-start?

* 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 <nandre@riseup.net>
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
This commit is contained in:
Zacchaeus 2025-07-12 00:20:40 -07:00 committed by Sharlatan Hellseher
parent 6768e33bcc
commit 16dbd20852
No known key found for this signature in database
GPG key ID: 76D727BFF62CD2B5
2 changed files with 9 additions and 1 deletions

View file

@ -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 <shepherd-service> 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.")))))