aboutsummaryrefslogtreecommitdiffstats
path: root/oni/home/services
diff options
context:
space:
mode:
authorGravatar Tom Willemse2022-04-20 21:19:40 -0700
committerGravatar Tom Willemse2022-04-20 21:19:40 -0700
commit33ef2ba4f1c866013724382e3c4a49a3e89c0692 (patch)
tree3dcf0566afe4170a0c9f6148fbab5c55eac2b6db /oni/home/services
parenta0034e7659a957997a58b7495abad8e6788f80ad (diff)
downloadnew-dotfiles-33ef2ba4f1c866013724382e3c4a49a3e89c0692.tar.gz
new-dotfiles-33ef2ba4f1c866013724382e3c4a49a3e89c0692.zip
Make the syncthing service run syncthing, add syncthing-gtk service
The ‘syncthing-gtk’ program doesn't seem to start the syncthing daemon automatically. In fact trying to start ‘syncthing-gtk’ through shepherd doesn't seem to want to work at the moment, complaining that it can't close a bunch of file descriptors.
Diffstat (limited to 'oni/home/services')
-rw-r--r--oni/home/services/syncthing-gtk.scm48
-rw-r--r--oni/home/services/syncthing.scm9
2 files changed, 53 insertions, 4 deletions
diff --git a/oni/home/services/syncthing-gtk.scm b/oni/home/services/syncthing-gtk.scm
new file mode 100644
index 0000000..e6cfe7f
--- /dev/null
+++ b/oni/home/services/syncthing-gtk.scm
@@ -0,0 +1,48 @@
+(define-module (oni home services syncthing-gtk)
+ #:use-module (gnu services configuration)
+ #:use-module (gnu packages syncthing)
+ #:use-module (gnu home services)
+ #:use-module (gnu home services shepherd)
+ #:use-module (gnu home services utils)
+ #:use-module (guix packages)
+ #:use-module (guix gexp)
+
+ #:export (home-syncthing-gtk-service-type
+ home-syncthing-gtk-configuration))
+
+(define-configuration home-syncthing-gtk-configuration
+ (package
+ (package syncthing-gtk)
+ "Package to use for setting syncthing-gtk"))
+
+(define (add-syncthing-gtk-packages config)
+ (list (home-syncthing-gtk-configuration-package config)))
+
+(define (home-syncthing-gtk-shepherd-service config)
+ (list
+ (shepherd-service
+ (documentation "Start syncthing-gtk")
+ (provision '(syncthing-gtk syncthing-ui))
+ (requirement '(syncthing))
+ (auto-start? #t)
+ (start
+ #~(make-forkexec-constructor
+ (list #$(file-append (home-syncthing-gtk-configuration-package config) "/bin/syncthing-gtk")
+ "--minimized"
+ #:log-file (format #f "~a/.local/var/log/syncthing-gtk.log" (getenv "HOME")))))
+ (stop
+ #~(make-kill-destructor)))))
+
+(define home-syncthing-gtk-service-type
+ (service-type
+ (name 'home-syncthing-gtk)
+ (extensions
+ (list (service-extension
+ home-profile-service-type
+ add-syncthing-gtk-packages)
+ (service-extension
+ home-shepherd-service-type
+ home-syncthing-gtk-shepherd-service)))
+ (compose identity)
+ (default-value (home-syncthing-gtk-configuration))
+ (description "Install and configure syncthing-gtk.")))
diff --git a/oni/home/services/syncthing.scm b/oni/home/services/syncthing.scm
index eee8d23..c12de05 100644
--- a/oni/home/services/syncthing.scm
+++ b/oni/home/services/syncthing.scm
@@ -12,7 +12,7 @@
(define-configuration home-syncthing-configuration
(package
- (package syncthing-gtk)
+ (package syncthing)
"Package to use for setting syncthing"))
(define (add-syncthing-packages config)
@@ -26,9 +26,10 @@
(auto-start? #t)
(start
#~(make-forkexec-constructor
- (list #$(file-append (home-syncthing-configuration-package config) "/bin/syncthing-gtk")
- "--minimized"
- #:log-file (format #f "~a/.local/var/log/syncthing.log" (getenv "HOME")))))
+ (list #$(file-append (home-syncthing-configuration-package config) "/bin/syncthing")
+ "serve"
+ "--logfile" (format #f "~a/.local/var/log/syncthing.log" (getenv "HOME"))
+ "--no-browser")))
(stop
#~(make-kill-destructor)))))