aboutsummaryrefslogtreecommitdiff
path: root/gnu/services/syncthing.scm
diff options
context:
space:
mode:
authorLiliana Marie Prikler <liliana.prikler@gmail.com>2023-08-26 07:08:03 +0200
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2023-08-26 07:08:03 +0200
commit9d074e16c7a9879d67c348c7b2d70b725adfbdfa (patch)
treec4c8dc52508717b3b7aa7c988924a03aa6eb83d8 /gnu/services/syncthing.scm
parentca7e310f7ac32354b2e693e9a0f783320952a8fc (diff)
parenteeb71d778f149834015858467fbeeb1276d96d1d (diff)
downloadguix-9d074e16c7a9879d67c348c7b2d70b725adfbdfa.tar.gz
guix-9d074e16c7a9879d67c348c7b2d70b725adfbdfa.zip
Merge branch 'master' into emacs-team
Diffstat (limited to 'gnu/services/syncthing.scm')
-rw-r--r--gnu/services/syncthing.scm56
1 files changed, 31 insertions, 25 deletions
diff --git a/gnu/services/syncthing.scm b/gnu/services/syncthing.scm
index c1a0cdd81f..2f7c822827 100644
--- a/gnu/services/syncthing.scm
+++ b/gnu/services/syncthing.scm
@@ -49,35 +49,41 @@
(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-lambda
- (($ <syncthing-configuration> syncthing arguments logflags user group home)
- (list
- (shepherd-service
- (provision (list (string->symbol (string-append "syncthing-" user))))
- (documentation "Run syncthing.")
- (requirement '(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
- #: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)
+ (match-record-lambda <syncthing-configuration>
+ (syncthing arguments logflags user group home home-service?)
+ (list
+ (shepherd-service
+ (provision (if home-service?
+ '(syncthing)
+ (list (string->symbol
+ (string-append "syncthing-" user)))))
+ (documentation "Run syncthing.")
+ (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 #$(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")
+ (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)))))))
+ (string-prefix? "SSL_CERT_FILE=" str))))
+ (environ)))))
+ (respawn? #f)
+ (stop #~(make-kill-destructor))))))
(define syncthing-service-type
(service-type (name 'syncthing)