Subject: [bug#76562] [PATCH] gnu: Add pegasus-frontend

From: Andreas Fuglesteg Dale <[email-masked]>
Date: Tue, 25 Feb 2025 18:58:50 +0100

* gnu/packages/emulators.scm (pegasus-frontend): New variable.

Change-Id: Ie1f186c0bfd303796b04bd80d2bd3c719391c99e
---
 gnu/packages/emulators.scm | 52 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
index 9e2d648..4fccb8c 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -22,6 +22,7 @@
 ;;; Copyright © 2023 Hendursaga <[email-masked]>
 ;;; Copyright © 2023 Zheng Junjie <[email-masked]>
 ;;; Copyright © 2024 Artyom V. Poptsov <[email-masked]>
+;;; Copyright © 2025 Andreas Fuglesteg Dale <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -112,6 +113,7 @@ (define-module (gnu packages emulators)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages web)
+  #:use-module (gnu packages gstreamer)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system copy)
   #:use-module (guix build-system glib-or-gtk)
@@ -4085,3 +4087,53 @@ (define-public emu8051
       (synopsis "8051/8052 emulator with curses-based UI")
       (description "emu8051 is a simulator of the 8051/8052 microcontrollers.")
       (license license:expat))))
+
+(define-public pegasus-frontend
+  (package
+    (name "pegasus-frontend")
+    (version "weekly_2024w38")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/mmatyas/pegasus-frontend")
+             (commit version)
+             (recursive? #t)))
+       (sha256
+        (base32 "04773v3b50wya7w3hgy6j8sli07aimsfc8njqsycg9gbqygm183l"))
+       (file-name (git-file-name name version))))
+    (build-system qt-build-system)
+    (arguments
+     (list
+      #:qtbase qtbase-5
+      #:phases #~(modify-phases %standard-phases
+                   (add-after 'qt-wrap 'gst-wrap
+                     ;; Set required environment variable for gstreamer plugins
+                     ;; Used for video playback
+                     (lambda _
+                       (wrap-program (string-append #$output "/bin/pegasus-fe")
+                         `("GST_PLUGIN_SYSTEM_PATH" suffix
+                           (,(string-append #$gst-plugins-good
+                                            "/lib/gstreamer-1.0"))))))
+                   (add-before 'check 'set-display
+                     (lambda _
+                       ;; Required for tests to not attempt to start an OpenGL context
+                       (setenv "QT_QUICK_BACKEND" "software"))))))
+    (inputs (list sdl2
+                  qtbase-5
+                  qtsvg-5
+                  qtdeclarative-5
+                  qtgraphicaleffects
+                  qtmultimedia-5
+                  qtgamepad
+                  gst-plugins-good ; For video playback
+                  bash-minimal)) ; For wrap-program
+    (native-inputs (list qttools-5))
+    (synopsis "Customizable graphical emulator frontend")
+    (description
+     "Pegasus is a graphical frontend for browsing your game library and launching all
+   kinds of emulators from the same place.  It's focusing on customizability, cross
+   platform support (including embedded) and high performance.")
+    (home-page "https://pegasus-frontend.org")
+    (license license:gpl3)))
+

base-commit: 87045f0982bd7aebb07b380cbf322651227546f4
-- 
2.48.1