aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--oni/home/data/config.scm7
-rw-r--r--oni/home/services/syncthing.scm48
2 files changed, 53 insertions, 2 deletions
diff --git a/oni/home/data/config.scm b/oni/home/data/config.scm
index 1e50776..217b239 100644
--- a/oni/home/data/config.scm
+++ b/oni/home/data/config.scm
@@ -19,7 +19,8 @@
#:use-module (oni home services herbstluftwm)
#:use-module (oni home services polybar)
#:use-module (oni home services kdeconnect)
- #:use-module (oni home services cmst))
+ #:use-module (oni home services cmst)
+ #:use-module (oni home services syncthing))
(home-environment
(packages (list (specification->package+output "glibc-locales")
@@ -366,4 +367,6 @@
(service home-kdeconnect-service-type)
- (service home-cmst-service-type))))
+ (service home-cmst-service-type)
+
+ (service home-syncthing-service-type))))
diff --git a/oni/home/services/syncthing.scm b/oni/home/services/syncthing.scm
new file mode 100644
index 0000000..821f813
--- /dev/null
+++ b/oni/home/services/syncthing.scm
@@ -0,0 +1,48 @@
+(define-module (oni home services syncthing)
+ #: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-service-type
+ home-syncthing-configuration))
+
+(define-configuration home-syncthing-configuration
+ (package
+ (package syncthing-gtk)
+ "Package to use for setting syncthing"))
+
+(define (add-syncthing-packages config)
+ (list (home-syncthing-configuration-package config)))
+
+(define (home-syncthing-shepherd-service config)
+ (list
+ (shepherd-service
+ (documentation "Start syncthing")
+ (provision '(syncthing))
+ (auto-start? #t)
+ (start
+ #~(make-system-constructor
+ #$(file-append (home-syncthing-configuration-package config) "/bin/syncthing-gtk")
+ " --minimized"))
+ (stop
+ #~(make-system-destructor
+ #$(file-append (home-syncthing-configuration-package config) "/bin/syncthing-gtk")
+ " --quit")))))
+
+(define home-syncthing-service-type
+ (service-type
+ (name 'home-syncthing)
+ (extensions
+ (list (service-extension
+ home-profile-service-type
+ add-syncthing-packages)
+ (service-extension
+ home-shepherd-service-type
+ home-syncthing-shepherd-service)))
+ (compose identity)
+ (default-value (home-syncthing-configuration))
+ (description "Install and configure syncthing.")))