nongnu: electron-27: Improve style.

* nongnu/packages/electron.scm (electron-27): Improve style.
  [arguments]: Rewrite using Gexps.
  [inputs, native-inputs]: Rewrite.
This commit is contained in:
Nicolas Graves 2025-06-21 14:21:19 +02:00 committed by Nicolas Graves
parent 94c750ad59
commit caa0d05a3e

View file

@ -5,11 +5,13 @@
;;; Copyright © 2024 Jonathan Brielmaier <jonathan.brielmaier@web.de>
;;; Copyright © 2025 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2025 Simen Endsjø <contact@simendsjo.me>
;;; Copyright © 2025 Nicolas Graves <ngraves@ngraves.fr>
(define-module (nongnu packages electron)
#:use-module (nonguix build-system chromium-binary)
#:use-module ((nonguix licenses) :prefix license:)
#:use-module (guix download)
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix utils)
#:use-module (ice-9 match)
@ -42,47 +44,45 @@
"0qs5n6m0gj0rknjq5aqrbbpqwh2829a1cl51l6xj79p7aiggb9p3"))
(build-system chromium-binary-build-system)
(arguments
`(#:wrapper-plan
`("electron"
"libffmpeg.so"
"libGLESv2.so"
"libEGL.so")
#:install-plan
`(("." "share/electron/" #:include
("electron"
"chrome-sandbox"
"chrome_100_percent.pak"
"chrome_200_percent.pak"
"chrome_crashpad_handler"
"icudtl.dat"
"resources.pak"
"v8_context_snapshot.bin"
"version"
"libffmpeg.so"
;; electron seems to force-load these from its directory.
"libEGL.so"
"libGLESv2.so"))
("resources" "share/electron/")
("locales" "share/electron/"))
#:phases
(modify-phases %standard-phases
(add-before 'install-wrapper 'wrap-where-patchelf-does-not-work
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(bin (string-append out "/share/electron/electron"))
(wrapper (string-append out "/bin/electron")))
(mkdir-p (dirname wrapper))
(make-wrapper wrapper bin
`("LD_LIBRARY_PATH" ":"
prefix
(,(string-join
(list
(string-append out "/share/electron"))
":")))))
#t)))))
(native-inputs `(("unzip" ,unzip)))
(inputs `(("gdk-pixbuf" ,gdk-pixbuf)
("ffmpeg" ,ffmpeg)))
(list
#:wrapper-plan
#~'("electron"
"libffmpeg.so"
"libGLESv2.so"
"libEGL.so")
#:install-plan
#~'(("." "share/electron/" #:include
("electron"
"chrome-sandbox"
"chrome_100_percent.pak"
"chrome_200_percent.pak"
"chrome_crashpad_handler"
"icudtl.dat"
"resources.pak"
"v8_context_snapshot.bin"
"version"
"libffmpeg.so"
;; electron seems to force-load these from its directory.
"libEGL.so"
"libGLESv2.so"))
("resources" "share/electron/")
("locales" "share/electron/"))
#:phases
#~(modify-phases %standard-phases
(add-before 'install-wrapper 'wrap-where-patchelf-does-not-work
(lambda* (#:key inputs #:allow-other-keys)
(let ((bin (string-append #$output "/share/electron/electron"))
(wrapper (string-append #$output "/bin/electron")))
(mkdir-p (dirname wrapper))
(make-wrapper wrapper bin
`("LD_LIBRARY_PATH" ":"
prefix
(,(string-join
(list
(string-append out "/share/electron"))
":"))))))))))
(native-inputs (list unzip))
(inputs (list ffmpeg gdk-pixbuf))
(home-page "https://www.electronjs.org/")
(synopsis "Cross platform desktop application shell")
(description "The Electron framework lets you write cross-platform desktop