games.scm (6927B)
1 (define-module (mt packages games) 2 #:use-module (guix licenses) 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 gl) 9 #:use-module (gnu packages image) 10 #:use-module (gnu packages java) 11 #:use-module (gnu packages kde-frameworks) 12 #:use-module (gnu packages libedit) 13 #:use-module (gnu packages ncurses) 14 #:use-module (gnu packages pkg-config) 15 #:use-module (gnu packages pulseaudio) 16 #:use-module (gnu packages qt) 17 #:use-module (gnu packages speech) 18 #:use-module (gnu packages sqlite) 19 #:use-module (gnu packages video) 20 #:use-module (guix build-system cmake) 21 #:use-module (guix build-system qt) 22 #:use-module (guix download) 23 #:use-module (guix gexp)) 24 25 ;; Controller patches for GLFW 3.4 26 ;; Pulled from https://github.com/mdqinc/SDL_GameControllerDB 27 28 ;; Mappings for the 8BitDo Ultimate 2C controller. 29 (define 8bitdo-ultimate-2c-patch 30 (plain-file "8bitdo-ultimate-2c-glfw-3.4.patch" "\ 31 --- a/src/mappings.h 2025-10-23 11:33:49.165631631 -0400 32 +++ b/src/mappings.h 2025-10-23 11:35:10.850409920 -0400 33 @@ -996,6 +996,9 @@ 34 \"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,\", 35 \"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,\", 36 \"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,\", 37 +\"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,\", 38 +\"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,\", 39 +\"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,\" 40 #endif // GLFW_BUILD_LINUX_JOYSTICK 41 };")) 42 43 (define-public glfw-mc 44 (package 45 (inherit glfw-3.4) 46 (name "glfw-mc") 47 (version "3.4") 48 (source (origin 49 (method url-fetch) 50 (uri (string-append "https://github.com/glfw/glfw" 51 "/releases/download/" version 52 "/glfw-" version ".zip")) 53 (sha256 54 (base32 55 "1sd396kkn53myp61kxrd18h7b1q4ix173hhxhvl0iz8j4x5h1v5m")) 56 (patches (list 8bitdo-ultimate-2c-patch)))) 57 (synopsis "A patched version of GLFW 3.4 that works better with Minecraft 58 out of the box. Intended to replace the bundled version."))) 59 60 ;; For playing Minecraft. Setup to run on Wayland by default. 61 ;; TODO: Support X11 62 (define-public prismlauncher 63 (package 64 (name "prismlauncher") 65 (version "9.4") 66 (source 67 (origin 68 (method git-fetch) 69 (uri (git-reference 70 (url "https://github.com/PrismLauncher/PrismLauncher") 71 (recursive? #t) 72 (commit version))) 73 (file-name (git-file-name name version)) 74 (sha256 75 (base32 76 "1xxgyx0z5r3hk3yk4gglbfwvq2qk1j9a0dkrv55j4vrlkni79nrm")))) 77 (build-system cmake-build-system) 78 (arguments 79 `(#:phases 80 (modify-phases %standard-phases 81 ;; Patch default settings to use native libraries 82 (add-after 'unpack 'change-default-settings 83 (lambda* (#:key inputs #:allow-other-keys) 84 (substitute* "launcher/Application.cpp" 85 (("\"UseNativeGLFW\", false") 86 "\"UseNativeGLFW\", true") 87 (("\"UseNativeOpenAL\", false") 88 "\"UseNativeOpenAL\", true")))) 89 ;; Add required environment variables 90 (add-after 'install 'patch-paths 91 (lambda* (#:key inputs outputs #:allow-other-keys) 92 (let* ((out (assoc-ref outputs "out")) 93 (bin (string-append out "/bin/prismlauncher")) 94 (jdk21 (assoc-ref inputs "jdk21")) 95 (jdk17 (assoc-ref inputs "jdk17")) 96 (qtwayland (assoc-ref inputs "qtwayland")) 97 (qtsvg (assoc-ref inputs "qtsvg"))) 98 (wrap-program bin 99 ;; Add all the OpenJDK versions for Minecraft as needed 100 `("PRISMLAUNCHER_JAVA_PATHS" ":" suffix (,(string-append jdk21 "/bin/java") 101 ,(string-append jdk17 "/bin/java"))) 102 ;; Fix QT plugins (primarily for wayland support) 103 `("QT_PLUGIN_PATH" ":" prefix ,(map (lambda (package) 104 (string-append package "/lib/qt6/plugins")) 105 (list qtwayland qtsvg))) 106 ;; Add runtime libraries for MC 107 ;; TODO: Provide these via PrismLauncher wrapper 108 `("LD_LIBRARY_PATH" ":" prefix 109 (,@(map (lambda (dep) 110 (string-append (assoc-ref inputs dep) 111 "/lib")) 112 '("glfw" "mesa" "pulseaudio" "openal" "flite"))))) 113 #t)))))) 114 (native-inputs (list pkg-config extra-cmake-modules)) 115 (inputs 116 `(("zlib" ,zlib) 117 ("qtbase" ,qtbase) 118 ("qt5compat" ,qt5compat) 119 ("qtnetworkauth" ,qtnetworkauth) 120 ("qtwayland" ,qtwayland) 121 ("qtsvg" ,qtsvg) 122 ;; Java versions to include 123 ("jdk17" ,openjdk17 "jdk") 124 ("jdk21" ,openjdk21 "jdk") 125 ;; Runtime deps for MC itself 126 ("glfw" ,glfw-mc) 127 ("mesa" ,mesa) 128 ("flite" ,flite) 129 ("openal" ,openal) 130 ("pulseaudio" ,pulseaudio))) 131 (home-page "https://prismlauncher.org/") 132 (synopsis #f) 133 (description #f) 134 (license gpl3)))
