From b4de52e2b5c986c5477132d9688b8270bf67767e Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 17 Feb 2024 11:50:45 -0500 Subject: Add package-with-pw-jack helper and use it for ardour. --- dthompson/home/pipewire.scm | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'dthompson/home/pipewire.scm') diff --git a/dthompson/home/pipewire.scm b/dthompson/home/pipewire.scm index bff47ea..600db49 100644 --- a/dthompson/home/pipewire.scm +++ b/dthompson/home/pipewire.scm @@ -1,6 +1,9 @@ ;; Snarfed from David Wilson who I believe snarfed from Andrew Tropin. (define-module (dthompson home pipewire) + #:use-module (guix build-system trivial) + #:use-module (guix packages) #:use-module (gnu packages) + #:use-module (gnu packages bash) #:use-module (gnu packages linux) #:use-module (gnu services) #:use-module (gnu services configuration) @@ -98,3 +101,48 @@ ctl_type.pipewire { home-pipewire-xdg-configuration-service))) (default-value #f) (description "Configures and runs the Pipewire audio system."))) + +(define-public (package-with-pw-jack 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)) + (program* (string-append program ".real")) + (desktop (string-append #$output "/share/applications/" + #$program ".desktop"))) + (union-build #$output (list #$pkg) + #:create-all-directories? #t) + (when (file-exists? desktop) + (substitute* desktop + (("Exec=.*") + (string-append "Exec=" program "\n")))) + (rename-file program program*) + (call-with-output-file program + (lambda (port) + (display "#!" port) + (display #$bash-minimal port) + (display "/bin/sh" port) + (newline port) + (display "exec " port) + (display #$pipewire port) + (display "/bin/pw-jack " port) + (display program* port) + (display " \"$@\"" port) + (newline port))) + (chmod program #x555) + #t)))) + (synopsis (package-synopsis pkg)) + (description (package-description pkg)) + (home-page (package-home-page pkg)) + (license (package-license pkg)))) -- cgit v1.2.3