Add service that runs ‘mpc update’ on start-up
This commit is contained in:
parent
5f46121fc7
commit
061cfd930c
2 changed files with 42 additions and 2 deletions
|
@ -128,4 +128,5 @@
|
||||||
#:type "fifo"
|
#:type "fifo"
|
||||||
#:name "Visualizer"
|
#:name "Visualizer"
|
||||||
#:path "/tmp/mpd.fifo"
|
#:path "/tmp/mpd.fifo"
|
||||||
#:format "44100:16:2"))))))))
|
#:format "44100:16:2")))))
|
||||||
|
(service home-mpc-update-service-type))))
|
||||||
|
|
|
@ -12,7 +12,10 @@
|
||||||
|
|
||||||
#:export (home-mpd-service-type
|
#:export (home-mpd-service-type
|
||||||
home-mpd-configuration
|
home-mpd-configuration
|
||||||
<home-mpd-audio-output>))
|
<home-mpd-audio-output>
|
||||||
|
|
||||||
|
home-mpc-update-service-type
|
||||||
|
home-mpc-update-configuration))
|
||||||
|
|
||||||
(define (serialize-boolean field value)
|
(define (serialize-boolean field value)
|
||||||
"")
|
"")
|
||||||
|
@ -122,3 +125,39 @@
|
||||||
(compose identity)
|
(compose identity)
|
||||||
(default-value (home-mpd-configuration))
|
(default-value (home-mpd-configuration))
|
||||||
(description "Install and configure mpd.")))
|
(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.")))
|
||||||
|
|
Loading…
Reference in a new issue