aboutsummaryrefslogtreecommitdiffstats
path: root/oni/home/services/syncthing-gtk.scm
diff options
context:
space:
mode:
Diffstat (limited to 'oni/home/services/syncthing-gtk.scm')
-rw-r--r--oni/home/services/syncthing-gtk.scm48
1 files changed, 48 insertions, 0 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.")))