modules/ryan-packages/mozilla.scm
04dbaab85ed7836dafa57ee3328f0e16b01f35db
· 2.1 KB · 62 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 firefox* |
| 13 | (package/inherit |
| 14 | firefox |
| 15 | (inputs |
| 16 | (modify-inputs |
| 17 | (package-inputs firefox) |
| 18 | (delete "pipewire") |
| 19 | (append pipewire))))) |
| 20 | |
| 21 | (define-public firefox-wayland-new |
| 22 | (package |
| 23 | (inherit firefox*) |
| 24 | (name "firefox-wayland-new") |
| 25 | (native-inputs '()) |
| 26 | (inputs |
| 27 | `(("bash" ,bash-minimal) |
| 28 | ("pipewire" ,pipewire) |
| 29 | ("firefox" ,firefox*))) |
| 30 | (build-system trivial-build-system) |
| 31 | (arguments |
| 32 | '(#:modules ((guix build utils)) |
| 33 | #:builder |
| 34 | (begin |
| 35 | (use-modules (guix build utils)) |
| 36 | (let* ((bash (assoc-ref %build-inputs "bash")) |
| 37 | (firefox (assoc-ref %build-inputs "firefox")) |
| 38 | (pipewire (assoc-ref %build-inputs "pipewire")) |
| 39 | (out (assoc-ref %outputs "out")) |
| 40 | (exe (string-append out "/bin/firefox"))) |
| 41 | (mkdir-p (dirname exe)) |
| 42 | |
| 43 | (call-with-output-file exe |
| 44 | (lambda (port) |
| 45 | ;; NOTE: added "export LD_LIBRARY_PATH=pipewire" |
| 46 | ;; maybe this can be done better with `wrap-programm' |
| 47 | (format port "#!~a \n |
| 48 | export LD_LIBRARY_PATH=~a \n |
| 49 | export MOZ_ENABLE_WAYLAND=1 \n |
| 50 | exec ~a $@\n" |
| 51 | (string-append bash "/bin/bash") |
| 52 | (string-append pipewire "/lib") |
| 53 | (string-append firefox "/bin/firefox")))) |
| 54 | (chmod exe #o555) |
| 55 | |
| 56 | ;; Provide the manual and .desktop file. |
| 57 | (copy-recursively (string-append firefox "/share") |
| 58 | (string-append out "/share")) |
| 59 | (substitute* (string-append |
| 60 | out "/share/applications/firefox.desktop") |
| 61 | ((firefox) out)) |
| 62 | #t)))))) |