summaryrefslogtreecommitdiff
path: root/dthompson/home/pipewire.scm
diff options
context:
space:
mode:
Diffstat (limited to 'dthompson/home/pipewire.scm')
-rw-r--r--dthompson/home/pipewire.scm33
1 files changed, 33 insertions, 0 deletions
diff --git a/dthompson/home/pipewire.scm b/dthompson/home/pipewire.scm
index 600db49..9faa64c 100644
--- a/dthompson/home/pipewire.scm
+++ b/dthompson/home/pipewire.scm
@@ -146,3 +146,36 @@ ctl_type.pipewire {
(description (package-description pkg))
(home-page (package-home-page pkg))
(license (package-license pkg))))
+
+(define-public (package-with-pw-wrapper pkg program)
+ (package
+ (name (package-name pkg))
+ (version (package-version pkg))
+ (source #f)
+ (build-system trivial-build-system)
+ (arguments
+ (list
+ #:modules '((guix build union)
+ (guix build utils))
+ #:builder
+ #~(begin
+ (use-modules (ice-9 match)
+ (guix build union)
+ (guix build utils))
+ (let* ((program (string-append #$output "/bin/" #$program))
+ (desktop (string-append #$output "/share/applications/"
+ #$program ".desktop"))
+ (pw-lib (string-append #$pipewire "/lib")))
+ (union-build #$output (list #$pkg)
+ #:create-all-directories? #t)
+ (when (file-exists? desktop)
+ (substitute* desktop
+ (("Exec=.*")
+ (string-append "Exec=" program "\n"))))
+ (wrap-program program
+ #:sh (string-append #$bash-minimal "/bin/sh")
+ `("LD_LIBRARY_PATH" ":" prefix (,pw-lib)))))))
+ (synopsis (package-synopsis pkg))
+ (description (package-description pkg))
+ (home-page (package-home-page pkg))
+ (license (package-license pkg))))