modules/ryan-packages/mozilla.scm

adf9cb015d85d0014968b07a77d107ba81e962c9 · 2.1 KB · 63 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 export MOZ_USE_XINPUT2=1 \n
51 exec ~a $@\n"
52 (string-append bash "/bin/bash")
53 (string-append pipewire "/lib")
54 (string-append firefox "/bin/firefox"))))
55 (chmod exe #o555)
56
57 ;; Provide the manual and .desktop file.
58 (copy-recursively (string-append firefox "/share")
59 (string-append out "/share"))
60 (substitute* (string-append
61 out "/share/applications/firefox.desktop")
62 ((firefox) out))
63 #t))))))