summaryrefslogtreecommitdiff
path: root/modules/ryan-packages/mozilla.scm
blob: 8959b07a4e8dcd1582bbef2ab90e4d03d39e8cd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
(define-module (ryan-packages mozilla)
  #:use-module (gnu)
  #:use-module (guix download)
  #:use-module (guix packages)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (gnu packages bash)
  #:use-module (gnu packages linux)
  #:use-module (nonguix build-system binary)
  #:use-module (guix build-system trivial)
  #:use-module (nongnu packages mozilla))

(define firefox*
  (package/inherit
   firefox
    (inputs
    (modify-inputs
     (package-inputs firefox)
     (delete "pipewire")
     (append pipewire)))))

(define-public firefox-wayland-new
  (package
    (inherit firefox*)
    (name "firefox-wayland-new")
    (native-inputs '())
    (inputs
     `(("bash" ,bash-minimal)
       ("pipewire" ,pipewire)
       ("firefox" ,firefox*)))
    (build-system trivial-build-system)
    (arguments
     '(#:modules ((guix build utils))
       #:builder
       (begin
         (use-modules (guix build utils))
         (let* ((bash    (assoc-ref %build-inputs "bash"))
                (firefox (assoc-ref %build-inputs "firefox"))
                (pipewire (assoc-ref %build-inputs "pipewire"))
                (out     (assoc-ref %outputs "out"))
                (exe     (string-append out "/bin/firefox")))
           (mkdir-p (dirname exe))

           (call-with-output-file exe
             (lambda (port)
               ;; NOTE: added "export LD_LIBRARY_PATH=pipewire"
               ;; maybe this can be done better with `wrap-programm'
               (format port "#!~a \n
export LD_LIBRARY_PATH=~a \n
export MOZ_ENABLE_WAYLAND=1 \n
exec ~a $@\n"
                       (string-append bash "/bin/bash")
                       (string-append pipewire "/lib")
                       (string-append firefox "/bin/firefox"))))
           (chmod exe #o555)

           ;; Provide the manual and .desktop file.
           (copy-recursively (string-append firefox "/share")
                             (string-append out "/share"))
           (substitute* (string-append
                         out "/share/applications/firefox.desktop")
             ((firefox) out))
           #t))))))