diff --git a/oni/home/config/rincewind.scm b/oni/home/config/rincewind.scm index 7b58931..4e4cacc 100644 --- a/oni/home/config/rincewind.scm +++ b/oni/home/config/rincewind.scm @@ -128,4 +128,5 @@ #:type "fifo" #:name "Visualizer" #:path "/tmp/mpd.fifo" - #:format "44100:16:2")))))))) + #:format "44100:16:2"))))) + (service home-mpc-update-service-type)))) diff --git a/oni/home/services/mpd.scm b/oni/home/services/mpd.scm index 6719754..c64fef2 100644 --- a/oni/home/services/mpd.scm +++ b/oni/home/services/mpd.scm @@ -12,7 +12,10 @@ #:export (home-mpd-service-type home-mpd-configuration - )) + + + home-mpc-update-service-type + home-mpc-update-configuration)) (define (serialize-boolean field value) "") @@ -122,3 +125,39 @@ (compose identity) (default-value (home-mpd-configuration)) (description "Install and configure mpd."))) + +(define-configuration home-mpc-update-configuration + (package + (package mpd-mpc) + "Package to use for setting MPC update") + (auto-start? + (boolean #t) + "Should mpc update be started automatically")) + +(define (add-mpc-update-packages config) + (list (home-mpc-update-configuration-package config))) + +(define (home-mpc-update-shepherd-service config) + (list + (shepherd-service + (documentation "Update MPD database") + (provision '(mpd-update)) + (auto-start? (home-mpc-update-configuration-auto-start? config)) + (one-shot? #t) + (start + #~(make-forkexec-constructor + '(#$(file-append mpd-mpc "/bin/mpc") "update")))))) + +(define home-mpc-update-service-type + (service-type + (name 'home-mpc-update) + (extensions + (list (service-extension + home-profile-service-type + add-mpc-update-packages) + (service-extension + home-shepherd-service-type + home-mpc-update-shepherd-service))) + (compose identity) + (default-value (home-mpc-update-configuration)) + (description "Install and configure mpc update.")))