diff options
| author | Ryan Schanzenbacher <ryan@rschanz.org> | 2023-05-18 01:57:03 -0400 |
|---|---|---|
| committer | Ryan Schanzenbacher <ryan@rschanz.org> | 2023-05-18 01:57:03 -0400 |
| commit | 3d495ba0b5c148b3d1d55cb3ad1004d1bf08841d (patch) | |
| tree | 836dd72a1143d91aac29b0594a04a309496dad00 /modules | |
| parent | 232a9f91d237df4741078e2cf2322e49fb1ddf06 (diff) | |
many changes, mostly migrations to using shepherd home services
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/ryan-services/pipewire.scm | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/modules/ryan-services/pipewire.scm b/modules/ryan-services/pipewire.scm new file mode 100644 index 0000000..cd2d10e --- /dev/null +++ b/modules/ryan-services/pipewire.scm | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | (define-module (ryan-services pipewire) | ||
| 2 | #:use-module (gnu packages) | ||
| 3 | #:use-module (gnu packages linux) | ||
| 4 | #:use-module (gnu services) | ||
| 5 | #:use-module (gnu services configuration) | ||
| 6 | #:use-module (gnu home services) | ||
| 7 | #:use-module (gnu home services shepherd) | ||
| 8 | #:use-module (guix gexp)) | ||
| 9 | |||
| 10 | (define (home-pipewire-profile-service config) | ||
| 11 | (map specification->package | ||
| 12 | (list "pipewire" | ||
| 13 | "wireplumber"))) | ||
| 14 | |||
| 15 | (define (home-pipewire-shepherd-service config) | ||
| 16 | (list | ||
| 17 | ;; Pipewire daemon | ||
| 18 | (shepherd-service | ||
| 19 | (requirement '(dbus)) | ||
| 20 | (provision '(pipewire)) | ||
| 21 | (stop #~(make-kill-destructor)) | ||
| 22 | (start #~(make-forkexec-constructor | ||
| 23 | (list #$(file-append pipewire "/bin/pipewire")) | ||
| 24 | #:log-file (string-append | ||
| 25 | (or (getenv "XDG_LOG_HOME") | ||
| 26 | (format #f "~a/.local/var/log" | ||
| 27 | (getenv "HOME"))) | ||
| 28 | "/pipewire.log") | ||
| 29 | #:environment-variables | ||
| 30 | (append (list "DISABLE_RTKIT=0") | ||
| 31 | (default-environment-variables))))) | ||
| 32 | ;; Pipewire-pulse | ||
| 33 | (shepherd-service | ||
| 34 | (requirement '(pipewire)) | ||
| 35 | (provision '(pipewire-pulse)) | ||
| 36 | (stop #~(make-kill-destructor)) | ||
| 37 | (start #~(make-forkexec-constructor | ||
| 38 | (list #$(file-append pipewire "/bin/pipewire-pulse")) | ||
| 39 | #:log-file (string-append | ||
| 40 | (or (getenv "XDG_LOG_HOME") | ||
| 41 | (format #f "~a/.local/var/log" | ||
| 42 | (getenv "HOME"))) | ||
| 43 | "/pipewire-pulse.log") | ||
| 44 | #:environment-variables | ||
| 45 | (append (list "DISABLE_RTKIT=0") | ||
| 46 | (default-environment-variables))))) | ||
| 47 | ;; Wireplumber | ||
| 48 | (shepherd-service | ||
| 49 | (requirement '(pipewire)) | ||
| 50 | (provision '(wireplumber)) | ||
| 51 | (stop #~(make-kill-destructor)) | ||
| 52 | (start #~(make-forkexec-constructor | ||
| 53 | (list #$(file-append wireplumber "/bin/wireplumber")) | ||
| 54 | #:log-file (string-append | ||
| 55 | (or (getenv "XDG_LOG_HOME") | ||
| 56 | (format #f "~a/.local/var/log" | ||
| 57 | (getenv "HOME"))) | ||
| 58 | "/wireplumber.log") | ||
| 59 | #:environment-variables | ||
| 60 | (append (list "DISABLE_RTKIT=0") | ||
| 61 | (default-environment-variables))))))) | ||
| 62 | |||
| 63 | (define (home-pipewire-xdg-configuration-service config) | ||
| 64 | `(("alsa/asoundrc" | ||
| 65 | ,(mixed-text-file | ||
| 66 | "asoundrc" | ||
| 67 | #~(string-append | ||
| 68 | "<" | ||
| 69 | #$(file-append | ||
| 70 | pipewire "/share/alsa/alsa.conf.d/50-pipewire.conf") | ||
| 71 | ">\n<" | ||
| 72 | #$(file-append | ||
| 73 | pipewire "/share/alsa/alsa.conf.d/99-pipewire-default.conf") | ||
| 74 | ">\n" | ||
| 75 | " | ||
| 76 | pcm_type.pipewire { | ||
| 77 | lib " #$(file-append pipewire "/lib/alsa-lib/libasound_module_pcm_pipewire.so") | ||
| 78 | " | ||
| 79 | } | ||
| 80 | ctl_type.pipewire { | ||
| 81 | lib " #$(file-append pipewire "/lib/alsa-lib/libasound_module_ctl_pipewire.so") | ||
| 82 | " | ||
| 83 | } | ||
| 84 | "))))) | ||
| 85 | |||
| 86 | (define-public home-pipewire-service-type | ||
| 87 | (service-type (name 'home-pipewire) | ||
| 88 | (extensions | ||
| 89 | (list (service-extension | ||
| 90 | home-profile-service-type | ||
| 91 | home-pipewire-profile-service) | ||
| 92 | (service-extension | ||
| 93 | home-shepherd-service-type | ||
| 94 | home-pipewire-shepherd-service) | ||
| 95 | (service-extension | ||
| 96 | home-xdg-configuration-files-service-type | ||
| 97 | home-pipewire-xdg-configuration-service))) | ||
| 98 | (default-value #f) | ||
| 99 | (description "Configures and runs Pipewire and Wireplumber"))) | ||
