modules/ryan-packages/mozilla.scm

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