(define-module (vesktop) #:use-module (gnu packages base) #:use-module (gnu packages bash) #:use-module (gnu packages compression) #:use-module (gnu packages cups) #:use-module (gnu packages fontutils) #:use-module (gnu packages gcc) #:use-module (gnu packages gl) #:use-module (gnu packages glib) #:use-module (gnu packages gnome) #:use-module (gnu packages gtk) #:use-module (gnu packages kerberos) #:use-module (gnu packages linux) #:use-module (gnu packages nss) #:use-module (gnu packages pulseaudio) #:use-module (gnu packages video) #:use-module (gnu packages xdisorg) #:use-module (gnu packages commencement) #:use-module (gnu packages xml) #:use-module (gnu packages xorg) #:use-module (gnu packages elf) #:use-module (gnu packages bash) #:use-module (gnu packages databases) #:use-module (guix download) #:use-module (guix gexp) #:use-module (guix build-system) #:use-module (guix build-system gnu) #:use-module (guix utils) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix transformations) #:use-module (nonguix build-system binary) #:use-module (nonguix build-system chromium-binary) #:use-module (nonguix licenses) #:use-module (ice-9 match) #:use-module (ice-9 session) #:use-module (srfi srfi-1) ) (define (use-modern-gcc-on-chromium-binary bs) "Based on guix build-system build-system-with-c-toolchain" (define lower (build-system-lower bs)) (define (lower* . args) (let ((lowered (apply lower args))) (bag (inherit lowered) (host-inputs `( ("source" , mesa) ;For some reason requires a "source" decleration, or else will fail. This is a placeholder value. TODO: Find a way to remove this without breakage. ("alsa-lib" ,alsa-lib) ("atk" ,atk) ("at-spi2-atk" ,at-spi2-atk) ("at-spi2-core" ,at-spi2-core) ("bash-minimal" ,bash-minimal) ("cairo" ,cairo) ("cups" ,cups) ("dbus" ,dbus) ("eudev" ,eudev) ("expat" ,expat) ("fontconfig" ,fontconfig) ("freetype" ,freetype) ("gcc:lib" ,gcc-13 "lib") ("gcc-toolchain" ,gcc-toolchain-13) ("glib" ,glib) ("gtk+" ,gtk+) ("libdrm" ,libdrm) ("libnotify" ,libnotify) ("librsvg" ,librsvg) ("libsecret" ,libsecret) ("libx11" ,libx11) ("libxcb" ,libxcb) ("libxcomposite" ,libxcomposite) ("libxcursor" ,libxcursor) ("libxdamage" ,libxdamage) ("libxext" ,libxext) ("libxfixes" ,libxfixes) ("libxi" ,libxi) ("libxkbcommon" ,libxkbcommon) ("libxkbfile" ,libxkbfile) ("libxrandr" ,libxrandr) ("libxrender" ,libxrender) ("libxshmfence" ,libxshmfence) ("libxtst" ,libxtst) ("mesa" ,mesa) ("mit-krb5" ,mit-krb5) ("nspr" ,nspr) ("nss" ,nss) ("pango" ,pango) ("pulseaudio" ,pulseaudio) ("pipewire", pipewire) ("sqlcipher" ,sqlcipher) ("xcb-util" ,xcb-util) ("xcb-util-image" ,xcb-util-image) ("xcb-util-keysyms" ,xcb-util-keysyms) ("xcb-util-renderutil" ,xcb-util-renderutil) ("xcb-util-wm" ,xcb-util-wm) ("zlib" ,zlib) ;; Keep the standard inputs of 'gnu-build-system'. ,@(standard-packages)))))) (lambda _ (display (lower* (host-inputs)))) (build-system (inherit bs) (lower lower*)) ) (define-public vesktop (package (name "vesktop-bin") (version "1.5.4") (source (origin (method url-fetch) (uri (string-append "https://github.com/Vencord/Vesktop/releases/download/v" version "/vesktop_" version "_amd64.deb")) (sha256 (base32 "0pvwkvk0q0dd3dziwmv83sxh69bb1n32zdkd8wyrc7j9zvp2pq0x")))) (supported-systems '("x86_64-linux")) (build-system (use-modern-gcc-on-chromium-binary chromium-binary-build-system)) (arguments (list #:validate-runpath? #f ; TODO: fails on wrapped binary and included other files #:wrapper-plan #~'( "lib/Vesktop/vesktop" ) #:phases #~(modify-phases %standard-phases (replace 'unpack (lambda _ (invoke "ar" "x" #$source) (invoke "tar" "xvf" "data.tar.xz") ;; Fix the .desktop file binary location. (substitute* '("usr/share/applications/vesktop.desktop") (("/opt/Vesktop/") (string-append #$output "/bin/"))) (copy-recursively "usr/" ".") ;; Use the more standard lib directory for everything. (rename-file "opt/" "lib") ;; Remove unneeded files. (delete-file-recursively "usr") (delete-file "control.tar.gz") (delete-file "data.tar.xz") (delete-file "debian-binary"))) (add-after 'install 'symlink-binary-file-and-cleanup (lambda _ (delete-file (string-append #$output "/environment-variables")) (mkdir-p (string-append #$output "/bin")) (symlink (string-append #$output "/lib/Vesktop/vesktop") (string-append #$output "/bin/discord")) (symlink (string-append #$output "/lib/Vesktop/vesktop") (string-append #$output "/bin/vencord")) )) (add-after 'install 'wrap-where-patchelf-does-not-work (lambda _ (wrap-program (string-append #$output "/lib/Vesktop/vesktop") `("LD_LIBRARY_PATH" ":" prefix (,(string-join (list (string-append #$(this-package-input "pipewire") "/lib") (string-append #$output "/lib/Vesktop") ;(string-append #$(this-package-input "gcc-toolchain") "/lib") ) ":")))))) ))) (inputs (list pipewire gcc-toolchain-13 gcc-13)) (native-inputs (list tar xz patchelf)) (home-page "https://github.com/Vencord/Vesktop") (synopsis "Discord experience with Vencord pre-installed") (description "Vesktop is a cross platform desktop app aiming to give you a snappier Discord experience with Vencord pre-installed") ;; not working? (properties '((release-monitoring-url . "https://github.com/Vencord/Vesktop/releases"))) (license license:gpl3)))