modules/ryan-packages/mozilla.scm
f3ee8355e3b453fc14ac3d6b63fb7368798d66d7
· 2.1 KB · 58 lines
raw
| 1 | (define-module (ryan-packages mozilla) |
| 2 | #:use-module (gnu) |
| 3 | #:use-module (guix download) |
| 4 | #:use-module (guix packages) |
| 5 | #:use-module ((guix licenses) #:prefix license:) |
| 6 | #:use-module (gnu packages bash) |
| 7 | #:use-module (gnu packages linux) |
| 8 | #:use-module (nonguix build-system binary) |
| 9 | #:use-module (guix build-system trivial) |
| 10 | #:use-module (nongnu packages mozilla)) |
| 11 | |
| 12 | (define-public firefox-wrapped |
| 13 | (package |
| 14 | (name "firefox-wrapped") |
| 15 | (source #f) |
| 16 | (version "0.1") |
| 17 | (synopsis "Simple wrapper for pipewire in firefox") |
| 18 | (description "Simple wrapper for pipewire in firefox") |
| 19 | (home-page "http://mozilla.org/") |
| 20 | (license license:mpl2.0) |
| 21 | (inputs |
| 22 | `(("bash" ,bash-minimal) |
| 23 | ("pipewire" ,pipewire) |
| 24 | ("firefox" ,firefox))) |
| 25 | (build-system trivial-build-system) |
| 26 | (arguments |
| 27 | '(#:modules ((guix build utils)) |
| 28 | #:builder |
| 29 | (begin |
| 30 | (use-modules (guix build utils)) |
| 31 | (let* ((bash (assoc-ref %build-inputs "bash")) |
| 32 | (firefox (assoc-ref %build-inputs "firefox")) |
| 33 | (pipewire (assoc-ref %build-inputs "pipewire")) |
| 34 | (out (assoc-ref %outputs "out")) |
| 35 | (exe (string-append out "/bin/firefox"))) |
| 36 | (mkdir-p (dirname exe)) |
| 37 | |
| 38 | (call-with-output-file exe |
| 39 | (lambda (port) |
| 40 | ;; NOTE: added "export LD_LIBRARY_PATH=pipewire" |
| 41 | ;; maybe this can be done better with `wrap-programm' |
| 42 | (format port "#!~a \n |
| 43 | export LD_LIBRARY_PATH=~a \n |
| 44 | export MOZ_ENABLE_WAYLAND=1 \n |
| 45 | export MOZ_USE_XINPUT2=1 \n |
| 46 | exec ~a $@\n" |
| 47 | (string-append bash "/bin/bash") |
| 48 | (string-append pipewire "/lib") |
| 49 | (string-append firefox "/bin/firefox")))) |
| 50 | (chmod exe #o555) |
| 51 | |
| 52 | ;; Provide the manual and .desktop file. |
| 53 | (copy-recursively (string-append firefox "/share") |
| 54 | (string-append out "/share")) |
| 55 | (substitute* (string-append |
| 56 | out "/share/applications/firefox.desktop") |
| 57 | ((firefox) out)) |
| 58 | #t)))))) |