1 { stdenv, lib, fetchFromGitHub, makeWrapper, curl, libusb1, xorg, libxml2
2 , ncurses5, bluez, libmhash, gimxPdpGamepad ? false }:
5 gimx-config = fetchFromGitHub {
7 repo = "GIMX-configurations";
8 rev = "c20300f24d32651d369e2b27614b62f4b856e4a0";
9 sha256 = "02wcjk8da188x7y0jf3p0arjdh9zbb0lla3fxdb28b1xyybfvx5p";
12 in stdenv.mkDerivation rec {
14 version = "unstable-2021-08-31";
16 src = fetchFromGitHub {
19 rev = "58d2098dce75ed4c90ae649460d3a7a150f4ef0a";
20 fetchSubmodules = true;
21 sha256 = "05kdv2qqr311c2p76hdlgvrq7b04vcpps5c80zn8b8l7p831ilgz";
24 patches = [ ./conf.patch ];
25 nativeBuildInputs = [ makeWrapper ];
27 curl libusb1 bluez libxml2 ncurses5 libmhash
28 xorg.libX11 xorg.libXi xorg.libXext
31 postPatch = lib.optionals gimxPdpGamepad ''
32 substituteInPlace ./shared/gimxcontroller/include/x360.h \
33 --replace "0x045e" "0x0e6f" --replace "0x028e" "0x0213"
34 substituteInPlace ./loader/firmware/EMU360.hex \
35 --replace "1B210001" "1B211001" \
36 --replace "09210001" "09211001" \
37 --replace "5E048E021001" "6F0E13020001"
40 makeFlags = [ "build-core" ];
45 substituteInPlace ./core/Makefile --replace "chmod ug+s" "echo"
48 make install-shared install-core
49 mv $out/usr/lib $out/lib
50 mv $out/usr/bin $out/bin
58 cp -r ./loader/firmware $out/share/firmware
59 cp -r ${gimx-config}/Linux $out/share/config
60 cp -r ${./custom} $out/share/custom
62 makeWrapper $out/bin/gimx $out/bin/gimx-dualshock4 \
63 --set GIMXCONF 1 --add-flags "--nograb" --add-flags "-p /dev/ttyUSB0" \
64 --add-flags "-c $out/share/custom/Dualshock4.xml"
66 makeWrapper $out/bin/gimx $out/bin/gimx-xboxonepad \
67 --set GIMXCONF 1 --add-flags "--nograb" --add-flags "-p /dev/ttyUSB0" \
68 --add-flags "-c $out/share/config/XOnePadUsb.xml"
72 homepage = "https://github.com/matlo/GIMX";
73 description = "Game Input Multiplexer";
74 license = licenses.gpl3Only;
75 platforms = platforms.linux;
76 maintainers = with maintainers; [ bb2020 ];