diff options
author | Ludovic Courtès <ludo@gnu.org> | 2023-08-06 22:11:55 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2023-08-20 22:48:48 +0200 |
commit | 7605c01fccb20b387f5a0d98d6b81074b3039e23 (patch) | |
tree | ae192b7f5327dce4564a317cb39cfcefc4f569ef /gnu/services | |
parent | 1ce3424e22bc89e01f9cc3a2eb01232715495bd3 (diff) | |
download | guix-7605c01fccb20b387f5a0d98d6b81074b3039e23.tar.gz |
home: services: Add Syncthing.
* gnu/home/services/syncthing.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * gnu/services/syncthing.scm (<syncthing-configuration>)[home-service?]: New field. Adjust 'provision' and 'requirement' depending on 'home-service?', and likewise for #:user and #:group. Use 'filter' + 'negate' instead of 'remove'. * doc/guix.texi (Networking Services): Add note and cross-reference to "Networking Home Services". (Networking Home Services): New node.
Diffstat (limited to 'gnu/services')
-rw-r--r-- | gnu/services/syncthing.scm | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/gnu/services/syncthing.scm b/gnu/services/syncthing.scm index e03e8e40b6..2f7c822827 100644 --- a/gnu/services/syncthing.scm +++ b/gnu/services/syncthing.scm @@ -49,32 +49,38 @@ (group syncthing-configuration-group ;string (default "users")) (home syncthing-configuration-home ;string - (default #f))) + (default #f)) + (home-service? syncthing-configuration-home-service? + (default for-home?) (innate))) (define syncthing-shepherd-service (match-record-lambda <syncthing-configuration> - (syncthing arguments logflags user group home) + (syncthing arguments logflags user group home home-service?) (list (shepherd-service - (provision (list (string->symbol (string-append "syncthing-" user)))) + (provision (if home-service? + '(syncthing) + (list (string->symbol + (string-append "syncthing-" user))))) (documentation "Run syncthing.") - (requirement '(loopback)) + (requirement (if home-service? '() '(loopback))) (start #~(make-forkexec-constructor (append (list (string-append #$syncthing "/bin/syncthing") "--no-browser" "--no-restart" (string-append "--logflags=" (number->string #$logflags))) '#$arguments) - #:user #$user - #:group #$group + #:user #$(and (not home-service?) user) + #:group #$(and (not home-service?) group) #:environment-variables (append (list (string-append "HOME=" (or #$home (passwd:dir (getpw #$user)))) "SSL_CERT_DIR=/etc/ssl/certs" "SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt") - (remove (lambda (str) - (or (string-prefix? "HOME=" str) - (string-prefix? "SSL_CERT_DIR=" str) - (string-prefix? "SSL_CERT_FILE=" str))) + (filter (negate ;XXX: 'remove' is not in (guile) + (lambda (str) + (or (string-prefix? "HOME=" str) + (string-prefix? "SSL_CERT_DIR=" str) + (string-prefix? "SSL_CERT_FILE=" str)))) (environ))))) (respawn? #f) (stop #~(make-kill-destructor)))))) |