Add mpv and mpv-mpris services

This commit is contained in:
Tom Willemse 2023-10-08 22:07:36 -07:00
parent df93ec50be
commit cb16d6af61
2 changed files with 108 additions and 4 deletions

View file

@ -37,9 +37,6 @@
tree-sitter-org
tree-sitter-json
tree-sitter-css))
#:use-module ((gnu packages video)
#:select (mpv
mpv-mpris))
#:use-module ((gnu packages)
#:select (specification->package+output))
#:use-module ((gnu services)
@ -92,6 +89,9 @@
<home-mpd-audio-output>
home-mpc-update-service-type
home-mpd-notify-service-type))
#:use-module ((oni home services mpv)
#:select (home-mpv-service-type
home-mpv-mpris-service-type))
#:use-module ((oni home services notmuch)
#:select (home-notmuch-service-type
home-notmuch-configuration))
@ -249,7 +249,7 @@
(define my-emacs emacs-next-tree-sitter)
(home-environment
(packages (list mpv mpv-mpris easytag
(packages (list easytag
(specification->package+output "glibc-locales")
(specification->package+output "font-fantasque-sans")
(specification->package+output "font-comic-neue")
@ -448,6 +448,9 @@
(service home-mpc-update-service-type)
(service home-mpd-notify-service-type)
(service home-mpv-service-type)
(service home-mpv-mpris-service-type)
(service home-stumpwm-service-type
(home-stumpwm-configuration
(package stumpwm+swank)

101
oni/home/services/mpv.scm Normal file
View file

@ -0,0 +1,101 @@
(define-module (oni home services mpv)
#:use-module ((gnu home services)
#:select (service-type
service-extension
home-profile-service-type
home-xdg-configuration-files-service-type))
#:use-module ((gnu services configuration)
#:select (serialize-package
define-configuration
define-configuration/no-serialization
text-config?
serialize-text-config))
#:use-module ((gnu packages video)
#:select (mpv mpv-mpris))
#:use-module ((guix packages)
#:select (package?))
#:use-module ((guix gexp)
#:select (mixed-text-file))
#:export (home-mpv-configuration
home-mpv-service-type
home-mpv-mpris-configuration
home-mpv-mpris-service-type))
(define-configuration/no-serialization home-mpv-extension
(configurations
(text-config '())
"The configuration foro the extension."))
(define-configuration home-mpv-configuration
(package
(package mpv)
"Package to use for setting mpv")
(configurations
(text-config '())
"Configuration for mpv."))
(define (add-mpv-packages config)
(list (home-mpv-configuration-package config)))
(define (home-mpv-extensions original-config extension-configs)
(home-mpv-configuration
(inherit original-config)
(configurations
(apply append (home-mpv-configuration-configurations original-config)
(map home-mpv-extension-configurations extension-configs)))))
(define (home-mpv-configuration-files config)
`(("mpv/mpv.conf"
,(mixed-text-file
"mpv.conf"
(serialize-text-config config (home-mpv-configuration-configurations config))))))
(define home-mpv-service-type
(service-type
(name 'home-mpv)
(extensions
(list (service-extension
home-profile-service-type
add-mpv-packages)
(service-extension
home-xdg-configuration-files-service-type
home-mpv-configuration-files)))
(compose identity)
(extend home-mpv-extensions)
(default-value (home-mpv-configuration))
(description "Install and configure Emacs.")))
(define-configuration/no-serialization home-mpv-mpris-configuration
(package
(package mpv-mpris)
"Package to use for setting mpv-mpris.")
(configurations
(text-config '())
"Configuration for mpv-mpris."))
(define (add-mpv-mpris config)
(home-mpv-extension
(configurations
(append
(list (mixed-text-file "mpris-config"
"scripts-append=" (home-mpv-mpris-configuration-package config) "/lib/mpris.so\n"))
(home-mpv-mpris-configuration-configurations config)))))
(define (add-mpv-mpris-packages config)
(list (home-mpv-mpris-configuration-package config)))
(define home-mpv-mpris-service-type
(service-type
(name 'home-mpv-mpris)
(extensions
(list (service-extension
home-mpv-service-type
add-mpv-mpris)
(service-extension
home-profile-service-type
add-mpv-mpris-packages)))
(compose identity)
(default-value (home-mpv-mpris-configuration))
(description "Install and configure mpv-mpris.")))