games.scm (8821B)


      1 (define-module (mt packages games)
      2   #:use-module ((guix licenses) #:prefix license:)
      3   #:use-module (guix packages)
      4   #:use-module (guix git-download)
      5   #:use-module (gnu packages audio)
      6   #:use-module (gnu packages compression)
      7   #:use-module (gnu packages elf)
      8   #:use-module (gnu packages freedesktop)
      9   #:use-module (gnu packages gl)
     10   #:use-module (gnu packages image)
     11   #:use-module (gnu packages java)
     12   #:use-module (gnu packages kde-frameworks)
     13   #:use-module (gnu packages libedit)
     14   #:use-module (gnu packages linux)
     15   #:use-module (gnu packages markup)
     16   #:use-module (gnu packages ncurses)
     17   #:use-module (gnu packages pkg-config)
     18   #:use-module (gnu packages pulseaudio)
     19   #:use-module (gnu packages qt)
     20   #:use-module (gnu packages speech)
     21   #:use-module (gnu packages sqlite)
     22   #:use-module (gnu packages video)
     23   #:use-module (gnu packages xdisorg)
     24   #:use-module (guix build-system cmake)
     25   #:use-module (guix build-system gnu)
     26   #:use-module (guix build-system meson)
     27   #:use-module (guix build-system qt)
     28   #:use-module (guix download)
     29   #:use-module (guix gexp))
     30 
     31 (define-public mcrcon
     32   (package
     33     (name "mcrcon")
     34     (version "0.7.2")
     35     (source (origin
     36               (method git-fetch)
     37               (uri (git-reference
     38                     (url "https://github.com/Tiiffi/mcrcon")
     39                     (commit (string-append "v" version))))
     40               (file-name (git-file-name name version))
     41               (sha256
     42                (base32
     43                 "0vj8la4ygk3xq2270mf28wswb71hl0a90y53iss2n4v0qqm5xrvi"))))
     44     (build-system gnu-build-system)
     45     (arguments
     46      (list
     47       #:make-flags
     48       #~(list (string-append "PREFIX=" #$output))
     49       #:phases
     50       #~(modify-phases %standard-phases
     51           (delete 'configure)
     52           (delete 'check))))
     53     (home-page "https://github.com/Tiiffi/mcrcon")
     54     (synopsis #f)
     55     (description #f)
     56     (license license:zlib)))
     57 
     58 ;; Controller patches for GLFW 3.4
     59 ;; Pulled from https://github.com/mdqinc/SDL_GameControllerDB
     60 
     61 ;; Mappings for the 8BitDo Ultimate 2C controller.
     62 (define 8bitdo-ultimate-2c-patch
     63   (plain-file "8bitdo-ultimate-2c-glfw-3.4.patch" "\
     64 --- a/src/mappings.h	2025-10-23 11:33:49.165631631 -0400
     65 +++ b/src/mappings.h	2025-10-23 11:35:10.850409920 -0400
     66 @@ -996,6 +996,9 @@
     67  \"03000000c0160000e105000001010000,Xin-Mo Xin-Mo Dual Arcade,a:b4,b:b3,back:b6,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b9,leftshoulder:b2,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b1,y:b0,platform:Linux,\",
     68  \"03000000120c0000100e000011010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,\",
     69  \"03000000120c0000101e000011010000,ZEROPLUS P4 Wired Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,\",
     70 +\"03000000c82d00000a31000014010000,8BitDo Ultimate 2C,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,\",
     71 +\"03000000c82d00001d30000011010000,8BitDo Ultimate 2C,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,paddle1:b5,paddle2:b2,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,\",
     72 +\"05000000c82d00001b30000001000000,8BitDo Ultimate 2C,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,paddle1:b5,paddle2:b2,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,\"
     73  #endif // GLFW_BUILD_LINUX_JOYSTICK
     74  };"))
     75 
     76 ;; TODO: Build with ALL controllers
     77 (define-public glfw-mc
     78   (package
     79     (inherit glfw-3.4)
     80     (name "glfw-mc")
     81     (version "3.4")
     82     (source (origin
     83               (method url-fetch)
     84               (uri (string-append "https://github.com/glfw/glfw"
     85                                   "/releases/download/" version
     86                                   "/glfw-" version ".zip"))
     87               (sha256
     88                (base32
     89                 "1sd396kkn53myp61kxrd18h7b1q4ix173hhxhvl0iz8j4x5h1v5m"))
     90               (patches (list 8bitdo-ultimate-2c-patch
     91                              (local-file "patches/glfw.diff")))))
     92     (synopsis "A patched version of GLFW 3.4 that works better with Minecraft
     93 out of the box. Intended to replace the bundled version.")))
     94 
     95 ;; TODO: scout-service-type?
     96 
     97 (define-public scout
     98   (let ((commit "4209589fbd04ec9c6a5505c2cf0752129cc4d9ab")
     99         (revision "1"))
    100     (package
    101       (name "scout")
    102       (version (git-version "0.1.0" revision commit))
    103       (source
    104        (origin
    105          (method git-fetch)
    106          (uri
    107           (git-reference
    108             (url "git://monastech.xyz/scout")
    109             (commit commit)))
    110          (file-name (git-file-name name version))
    111          (sha256
    112           (base32 "1hcij56vdjyq68xbqs5pfxcn1fhb0lkrqh45xigi14yxpbxlic5d"))))
    113       (build-system meson-build-system)
    114       (inputs (list pkg-config glfw-mc mesa libepoxy libinih))
    115       (synopsis "A simple game launcher.")
    116       (description #f)
    117       (home-page #f)
    118       (license license:gpl3+))))
    119 
    120 ;; For playing Minecraft. Setup to run on Wayland by default.
    121 ;; TODO: Support X11
    122 (define-public prismlauncher
    123   (package
    124     (name "prismlauncher")
    125     (version "9.4")
    126     (source
    127       (origin
    128         (method git-fetch)
    129         (uri (git-reference
    130               (url "https://github.com/PrismLauncher/PrismLauncher")
    131               (recursive? #t)
    132               (commit version)))
    133         (file-name (git-file-name name version))
    134         (patches (list (local-file "patches/prismlauncher.diff")))
    135         (sha256
    136          (base32
    137           "1xxgyx0z5r3hk3yk4gglbfwvq2qk1j9a0dkrv55j4vrlkni79nrm"))))
    138     (build-system cmake-build-system)
    139     (arguments
    140      `(#:phases
    141        (modify-phases %standard-phases
    142          (add-after 'install 'patch-paths
    143            (lambda* (#:key inputs outputs #:allow-other-keys)
    144              (let* ((out            (assoc-ref outputs "out"))
    145                     (bin            (string-append out "/bin/prismlauncher"))
    146                     (jdk25          (assoc-ref inputs "jdk25"))
    147                     (jdk21          (assoc-ref inputs "jdk21"))
    148                     (jdk17          (assoc-ref inputs "jdk17"))
    149                     (qtwayland      (assoc-ref inputs "qtwayland"))
    150                     (qtsvg          (assoc-ref inputs "qtsvg")))
    151                (wrap-program bin
    152                  ;; Add all the OpenJDK versions for Minecraft as needed
    153                  `("PRISMLAUNCHER_JAVA_PATHS" ":" suffix (,(string-append jdk25 "/bin/java")
    154                                                           ,(string-append jdk21 "/bin/java")
    155                                                           ,(string-append jdk17 "/bin/java")))
    156                  ;; Fix QT plugins (primarily for wayland support)
    157                  `("QT_PLUGIN_PATH" ":" prefix ,(map (lambda (package)
    158                                                        (string-append package "/lib/qt6/plugins"))
    159                                                      (list qtwayland qtsvg)))
    160                  ;; Add runtime libraries for MC
    161                  ;; TODO: Provide these via PrismLauncher wrapper
    162                  `("LD_LIBRARY_PATH" ":" prefix
    163                    (,@(map (lambda (dep)
    164                              (string-append (assoc-ref inputs dep)
    165                                           "/lib"))
    166                            '("glfw" "openal"
    167                              "wayland" "xkbcommon" "mesa" "pulseaudio" "flite")))))
    168                #t))))))
    169     (native-inputs (list pkg-config extra-cmake-modules))
    170     (inputs
    171      `(("zlib" ,zlib)
    172        ("qtbase" ,qtbase)
    173        ("qt5compat" ,qt5compat)
    174        ("qtnetworkauth" ,qtnetworkauth)
    175        ("qtwayland" ,qtwayland)
    176        ("qtsvg" ,qtsvg)
    177        ;; Java versions to include
    178        ("jdk17" ,openjdk17 "jdk")
    179        ("jdk21" ,openjdk21 "jdk")
    180        ("jdk25" ,openjdk25 "jdk")
    181        ;; Optional native libraries
    182        ("glfw" ,glfw-mc)
    183        ("openal" ,openal)
    184        ;; LWJGL runtime deps
    185        ("wayland" ,wayland)
    186        ("xkbcommon" ,libxkbcommon)
    187        ("mesa" ,mesa)
    188        ("flite" ,flite)
    189        ("pulseaudio" ,pulseaudio)))
    190     (home-page "https://prismlauncher.org/")
    191     (synopsis #f)
    192     (description #f)
    193     (license license:gpl3)))