nonguix/nongnu/packages/editors.scm
John Kehayias e65677969e
nonguix: binary-build-system: Use add-rpath instead of set-rpath.
Fixes #369.

Previously we were using "patchelf --set-rpath" in binary-build-system for
binaries to find dependencies in Guix.  However, this will override any
previous setting, including if "$ORIGIN" was in RUNPATH.

For Electron applications specifically (like signal-desktop and heroic),
bundled libraries were not found without wrapping with LD_LIBRARY_PATH.  While
this does work, it is not ideal and led to issues in child processes that
inherit LD_LIBRARY_PATH, namely breaking games using Wine/Proton in Heroic.

A possible consequence of this commit is that Guix added paths to RUNPATH are
after what was originally set, perhaps leading to library
loading/compatibility issues.  However, we always try to replace all needed
libraries with Guix packages (just that Electron applications seem to require
bundled libraries in $ORIGIN).

* nonguix/build/binary-build-system.scm (patchelf): Use add-rpath instead of set-rpath.
* nongnu/packages/game-client.scm (heroic-client)[arguments]<#:phases>: Remove
'wrap-where-patchelf-does-not-work phase as it is no longer needed (needed
libraries are found with $ORIGIN preserved in RUNPATH).
* nongnu/packages/messaging.scm (element-desktop, signal-desktop): Likewise.
* nongnu/packages/editors.scm (vscodium): Likewise.
2025-02-03 15:57:36 -05:00

97 lines
4.2 KiB
Scheme
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;;; SPDX-License-Identifier: GPL-3.0-or-later
;;; Copyright © 2023, 2024 Giacomo Leidi <goodoldpaul@autistici.org>
(define-module (nongnu packages editors)
#:use-module (gnu packages base)
#:use-module (gnu packages gtk)
#:use-module (guix download)
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module ((guix licenses) :prefix license:)
#:use-module (nonguix build-system chromium-binary)
#:use-module (ice-9 match))
(define-public vscodium
(package
(name "vscodium")
(version "1.92.1.24225")
(source
(let ((arch (match (or (%current-target-system) (%current-system))
("aarch64-linux" "arm64")
("armhf-linux" "armhf")
(_ "x64")))
(hash (match (or (%current-target-system) (%current-system))
("aarch64-linux"
"0m5x9v577h8n16ypzb1y2066alc59v5bw7jiqp2xr7g20s9kb0vy")
("armhf-linux"
"047gz12gx8pa5aglykd0785l6i9ivsn4kkgfhi5l0y4jh8hjys8c")
(_
"1w1rhbbk177yz85csck3sax51qnvgaip9w238dmzb4a50ikfnp23"))))
(origin
(method url-fetch)
(uri
(string-append
"https://github.com/VSCodium/vscodium/releases/download/" version
"/VSCodium-linux-" arch "-" version ".tar.gz"))
(sha256
(base32 hash)))))
(build-system chromium-binary-build-system)
(arguments
(list #:validate-runpath? #f ; TODO: fails on wrapped binary and included other files
#:substitutable? #f
#:wrapper-plan
#~'("opt/vscodium/codium")
#:phases
#~(modify-phases %standard-phases
(replace 'unpack
(lambda* (#:key source #:allow-other-keys)
(mkdir-p "opt/vscodium")
(invoke "tar" "-xvf" source "-C" "opt/vscodium")))
(add-before 'install-wrapper 'install-entrypoint
(lambda _
(let* ((bin (string-append #$output "/bin")))
(delete-file (string-append #$output "/environment-variables"))
(mkdir-p bin)
(symlink (string-append #$output "/opt/vscodium/codium")
(string-append bin "/codium")))))
(add-after 'install-entrypoint 'install-resources
(lambda _
(let* ((icons
(string-append #$output
"/share/icons/hicolor/512x512/apps"))
(icon.png
(string-append #$output
"/opt/vscodium/resources/app/"
"resources/linux/code.png"))
(apps (string-append #$output "/share/applications")))
(mkdir-p icons)
(symlink icon.png
(string-append icons "/code.png"))
(mkdir-p apps)
(make-desktop-entry-file
(string-append apps "/" #$name ".desktop")
#:name "VSCodium"
#:generic-name "Text Editor"
#:exec (string-append #$output "/bin/codium --ozone-platform-hint=auto")
#:icon "code"
#:type "Application"
#:actions '("new-empty-window")
#:keywords '("vscode")
#:categories '("TextEditor" "Development"
"IDE")
#:startup-notify #t
#:startup-w-m-class "Code"
#:comment
'(("en" "Code Editing. Redefined.")
(#f "Code Editing. Redefined.")))))))))
(supported-systems '("armhf-linux" "aarch64-linux" "x86_64-linux"))
(native-inputs
(list tar))
(inputs
(list gdk-pixbuf))
(home-page "https://vscodium.com/")
(synopsis "Community-driven, freely-licensed binary distribution of VSCode")
(description "VSCodium is a community-driven, freely-licensed binary
distribution of Microsofts editor VSCode.")
(license license:expat)))