dotfiles-guix/modules/home-packages/mozillia.scm

71 lines
2.3 KiB
Scheme
Raw Normal View History

2023-09-06 01:07:58 +00:00
(define-module (home-packages mozillia)
#: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)
2023-11-08 02:49:55 +00:00
#:use-module (guix utils)
#:use-module (guix build utils)
2023-09-06 01:07:58 +00:00
#:use-module (nonguix build-system binary)
#:use-module (guix build-system trivial)
2023-09-07 03:50:18 +00:00
#:use-module (nongnu packages mozilla))
2023-09-06 01:07:58 +00:00
(define firefox*
(package/inherit
firefox
(inputs
(modify-inputs
(package-inputs firefox)
(delete "pipewire")
2023-11-08 02:49:55 +00:00
(append pipewire)))
(arguments
(substitute-keyword-arguments (package-arguments firefox)
((#:phases phases)
#~(modify-phases #$phases
(delete 'check)))))))
2023-09-06 01:07:58 +00:00
2023-09-07 03:50:18 +00:00
(define-public firefox-wayland-new
2023-09-06 01:07:58 +00:00
(package
(inherit firefox*)
2023-09-06 12:51:42 +00:00
(name "firefox-wayland-new")
2023-09-06 01:07:58 +00:00
(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))))))