update home-pipewire-service-type

This commit is contained in:
Freya Murphy 2024-11-03 23:06:50 -05:00
parent 16c75c276a
commit b10ab400ef
Signed by: freya
GPG key ID: 9FBC6FFD6D2DBF17
2 changed files with 131 additions and 38 deletions

View file

@ -1,17 +1,25 @@
(define-module (sakura services pipewire) (define-module (sakura home services pipewire)
#:use-module (gnu packages) #:use-module (gnu packages)
#:use-module (gnu packages linux) #:use-module (gnu packages linux)
#:use-module (gnu services) #:use-module (gnu services)
#:use-module (gnu services configuration) #:use-module (gnu services configuration)
#:use-module (gnu home services) #:use-module (gnu home services)
#:use-module (gnu home services shepherd) #:use-module (gnu home services shepherd)
#:use-module (sakura packages networking) #:use-module (guix gexp)
#:use-module (guix gexp)) #:use-module (guix records)
#:export (home-pipewire-service-type
home-pipewire-configuration
home-pipewire-configuration?))
(define-record-type* <home-pipewire-configuration>
home-pipewire-configuration make-home-pipewire-configuration
home-pipewire-configuration?
(pipewire home-pipewire-configuration-pipewire (default pipewire))
(wireplumber home-pipewire-configuration-wireplumber (default wireplumber)))
(define (home-pipewire-profile-service config) (define (home-pipewire-profile-service config)
(list pipewire (list (home-pipewire-configuration-pipewire config)
wireplumber)) (home-pipewire-configuration-wireplumber config)))
(define (home-pipewire-shepherd-service config) (define (home-pipewire-shepherd-service config)
(list (list
@ -21,7 +29,8 @@
(provision '(pipewire)) (provision '(pipewire))
(stop #~(make-kill-destructor)) (stop #~(make-kill-destructor))
(start #~(make-forkexec-constructor (start #~(make-forkexec-constructor
(list #$(file-append pipewire "/bin/pipewire")) (list #$(file-append (home-pipewire-configuration-pipewire config)
"/bin/pipewire"))
#:log-file (string-append #:log-file (string-append
(or (getenv "XDG_LOG_HOME") (or (getenv "XDG_LOG_HOME")
(format #f "~a/.local/var/log" (format #f "~a/.local/var/log"
@ -36,7 +45,8 @@
(provision '(pipewire-pulse)) (provision '(pipewire-pulse))
(stop #~(make-kill-destructor)) (stop #~(make-kill-destructor))
(start #~(make-forkexec-constructor (start #~(make-forkexec-constructor
(list #$(file-append pipewire "/bin/pipewire-pulse")) (list #$(file-append (home-pipewire-configuration-pipewire config)
"/bin/pipewire-pulse"))
#:log-file (string-append #:log-file (string-append
(or (getenv "XDG_LOG_HOME") (or (getenv "XDG_LOG_HOME")
(format #f "~a/.local/var/log" (format #f "~a/.local/var/log"
@ -51,7 +61,8 @@
(provision '(wireplumber)) (provision '(wireplumber))
(stop #~(make-kill-destructor)) (stop #~(make-kill-destructor))
(start #~(make-forkexec-constructor (start #~(make-forkexec-constructor
(list #$(file-append wireplumber "/bin/wireplumber")) (list #$(file-append (home-pipewire-configuration-wireplumber config)
"/bin/wireplumber"))
#:log-file (string-append #:log-file (string-append
(or (getenv "XDG_LOG_HOME") (or (getenv "XDG_LOG_HOME")
(format #f "~a/.local/var/log" (format #f "~a/.local/var/log"
@ -67,25 +78,24 @@
"asoundrc" "asoundrc"
#~(string-append #~(string-append
"<" "<"
#$(file-append #$(file-append (home-pipewire-configuration-pipewire config)
pipewire "/share/alsa/alsa.conf.d/50-pipewire.conf") "/share/alsa/alsa.conf.d/50-pipewire.conf")
">\n<" ">\n<"
#$(file-append #$(file-append (home-pipewire-configuration-pipewire config)
pipewire "/share/alsa/alsa.conf.d/99-pipewire-default.conf") "/share/alsa/alsa.conf.d/99-pipewire-default.conf")
">\n" ">\n"
" "\npcm_type.pipewire {\n lib "
pcm_type.pipewire { #$(file-append (home-pipewire-configuration-pipewire config)
lib " #$(file-append pipewire "/lib/alsa-lib/libasound_module_pcm_pipewire.so") "/lib/alsa-lib/libasound_module_pcm_pipewire.so")
" "\n}ctl_type.pipewire {\n lib "
} #$(file-append (home-pipewire-configuration-pipewire config)
ctl_type.pipewire { "/lib/alsa-lib/libasound_module_ctl_pipewire.so")
lib " #$(file-append pipewire "/lib/alsa-lib/libasound_module_ctl_pipewire.so") "\n}\n"
" )))))
}
")))))
(define-public home-pipewire-service-type (define home-pipewire-service-type
(service-type (name 'home-pipewire) (service-type
(name 'home-pipewire)
(extensions (extensions
(list (service-extension (list (service-extension
home-profile-service-type home-profile-service-type
@ -96,5 +106,5 @@
(service-extension (service-extension
home-xdg-configuration-files-service-type home-xdg-configuration-files-service-type
home-pipewire-xdg-configuration-service))) home-pipewire-xdg-configuration-service)))
(default-value #f) (default-value (home-pipewire-configuration))
(description "Configures and runs Pipewire and Wireplumber"))) (description "Configures and runs Pipewire and Wireplumber")))

View file

@ -8,11 +8,14 @@
#:use-module (guix git-download) #:use-module (guix git-download)
#:use-module (guix build-system cargo) #:use-module (guix build-system cargo)
#:use-module (guix build-system meson) #:use-module (guix build-system meson)
#:use-module (guix build-system python)
#:use-module (gnu packages) #:use-module (gnu packages)
#:use-module (gnu packages linux) #:use-module (gnu packages linux)
#:use-module (gnu packages gcc) #:use-module (gnu packages gcc)
#:use-module (gnu packages gtk) #:use-module (gnu packages gtk)
#:use-module (gnu packages glib) #:use-module (gnu packages glib)
#:use-module (gnu packages bash)
#:use-module (gnu packages base)
#:use-module (gnu packages gnome) #:use-module (gnu packages gnome)
#:use-module (gnu packages pkg-config) #:use-module (gnu packages pkg-config)
#:use-module (gnu packages networking) #:use-module (gnu packages networking)
@ -20,7 +23,11 @@
#:use-module (gnu packages crates-gtk) #:use-module (gnu packages crates-gtk)
#:use-module (gnu packages pulseaudio) #:use-module (gnu packages pulseaudio)
#:use-module (gnu packages freedesktop) #:use-module (gnu packages freedesktop)
#:use-module (gnu packages compression)
#:use-module (gnu packages gettext) #:use-module (gnu packages gettext)
#:use-module (gnu packages gnome)
#:use-module (gnu packages python)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages rust) #:use-module (gnu packages rust)
#:use-module (sakura packages) #:use-module (sakura packages)
#:use-module (sakura packages crates-io)) #:use-module (sakura packages crates-io))
@ -119,8 +126,84 @@
dbus dbus
libadwaita libadwaita
pulseaudio pulseaudio
bluez)) bluez
gtk))
(home-page "https://github.com/kaii-lb/overskride") (home-page "https://github.com/kaii-lb/overskride")
(synopsis "A simple yet powerful bluetooth client.") (synopsis "A simple yet powerful bluetooth client.")
(description "todo") (description "todo")
(license license:gpl3+))) (license license:gpl3+)))
(define-public blueberry
(package
(name "blueberry")
(version "1.4.8")
(source
(origin
(method url-fetch)
(uri (string-append "https://github.com/linuxmint/blueberry"
"/archive/refs/tags/" version ".tar.gz"))
(file-name (git-file-name name version))
(sha256
(base32
"0cksdbxl55jm30inbiz5ryb675p2lab936r04pkcxg3w7jyb199p"))))
(build-system python-build-system)
(native-inputs
(modify-inputs (package-native-inputs gnome-bluetooth)
(append gnu-make)
(append gettext-minimal)
(append sed)))
(inputs
(modify-inputs (package-inputs gnome-bluetooth)
(append bash)
(append gnome-bluetooth)
(append python-pygobject)
(append python-setproctitle)))
(propagated-inputs
(package-propagated-inputs gnome-bluetooth))
(arguments
`(#:phases
(modify-phases %standard-phases
(replace 'unpack
(lambda* (#:key source #:allow-other-keys)
(invoke "tar" "xf" source "--strip-components=1")))
(add-after 'unpack 'patch
(lambda* (#:key inputs outputs #:allow-other-keys)
(substitute* (append
(find-files "usr/bin" ".*")
(find-files "usr/lib" ".*"))
; fix python schbang
(("/usr/bin/python3")
(string-append
(assoc-ref inputs "python") "/bin/python3"))
; fix sh schbang
(("/bin/sh")
(string-append
(assoc-ref inputs "bash") "/bin/sh"))
; fix blueberry file locations
(("/usr/(bin|lib|share)" cmd path)
(string-append
(assoc-ref outputs "out") "/" path)))))
(delete 'build)
(delete 'check)
(replace 'install
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")))
(mkdir-p out)
(copy-recursively
(assoc-ref inputs "gnome-bluetooth")
out)
(for-each (lambda (file)
(let* ((src (string-append "usr/" file))
(dst (string-append out "/" file)))
(mkdir-p dst)
(copy-recursively src dst)))
'("lib"
"share"
"bin"))
(invoke "make" "all"))))
)))
(home-page "")
(synopsis "")
(description "")
(license license:gpl3+)))