Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv, lib, fetchFromGitHub, makeWrapper, curl, libusb1, xorg, libxml2 2, ncurses5, bluez, libmhash, gimxPdpGamepad ? false }: 3 4let 5 gimx-config = fetchFromGitHub { 6 owner = "matlo"; 7 repo = "GIMX-configurations"; 8 rev = "c20300f24d32651d369e2b27614b62f4b856e4a0"; 9 sha256 = "02wcjk8da188x7y0jf3p0arjdh9zbb0lla3fxdb28b1xyybfvx5p"; 10 }; 11 12in stdenv.mkDerivation rec { 13 pname = "gimx"; 14 version = "unstable-2021-08-31"; 15 16 src = fetchFromGitHub { 17 owner = "matlo"; 18 repo = "GIMX"; 19 rev = "58d2098dce75ed4c90ae649460d3a7a150f4ef0a"; 20 fetchSubmodules = true; 21 sha256 = "05kdv2qqr311c2p76hdlgvrq7b04vcpps5c80zn8b8l7p831ilgz"; 22 }; 23 24 patches = [ ./conf.patch ]; 25 nativeBuildInputs = [ makeWrapper ]; 26 buildInputs = [ 27 curl libusb1 bluez libxml2 ncurses5 libmhash 28 xorg.libX11 xorg.libXi xorg.libXext 29 ]; 30 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" 38 ''; 39 40 makeFlags = [ "build-core" ]; 41 42 env.NIX_CFLAGS_COMPILE = toString [ 43 # Needed with GCC 12 44 "-Wno-error=address" 45 "-Wno-error=deprecated-declarations" 46 "-Wno-error=use-after-free" 47 ]; 48 49 installPhase = '' 50 runHook preInstall 51 52 mkdir -p $out 53 substituteInPlace ./core/Makefile --replace "chmod ug+s" "echo" 54 55 export DESTDIR="$out" 56 make install-shared install-core 57 mv $out/usr/lib $out/lib 58 mv $out/usr/bin $out/bin 59 rmdir $out/usr 60 61 runHook postInstall 62 ''; 63 64 postInstall = '' 65 mkdir -p $out/share 66 cp -r ./loader/firmware $out/share/firmware 67 cp -r ${gimx-config}/Linux $out/share/config 68 cp -r ${./custom} $out/share/custom 69 70 makeWrapper $out/bin/gimx $out/bin/gimx-dualshock4 \ 71 --set GIMXCONF 1 --add-flags "--nograb" --add-flags "-p /dev/ttyUSB0" \ 72 --add-flags "-c $out/share/custom/Dualshock4.xml" 73 74 makeWrapper $out/bin/gimx $out/bin/gimx-xboxonepad \ 75 --set GIMXCONF 1 --add-flags "--nograb" --add-flags "-p /dev/ttyUSB0" \ 76 --add-flags "-c $out/share/config/XOnePadUsb.xml" 77 ''; 78 79 meta = with lib; { 80 homepage = "https://github.com/matlo/GIMX"; 81 description = "Game Input Multiplexer"; 82 license = licenses.gpl3Only; 83 platforms = platforms.linux; 84 maintainers = with maintainers; [ bb2020 ]; 85 }; 86}