|
1 | | -{ stdenv, lib, fetchFromGitHub, fetchpatch |
2 | | -, makeWrapper, curl, libusb1, xorg, libxml2 |
3 | | -, ncurses5, bluez, libmhash, gimxPdpGamepad ? false }: |
| 1 | +{ stdenv, lib, fetchFromGitHub, makeWrapper, curl, libusb1, bluez, libxml2, ncurses5, libmhash, xorg }: |
4 | 2 |
|
5 | 3 | let |
6 | 4 | gimx-config = fetchFromGitHub { |
7 | 5 | owner = "matlo"; |
8 | 6 | repo = "GIMX-configurations"; |
9 | 7 | rev = "c20300f24d32651d369e2b27614b62f4b856e4a0"; |
10 | | - sha256 = "02wcjk8da188x7y0jf3p0arjdh9zbb0lla3fxdb28b1xyybfvx5p"; |
| 8 | + hash = "sha256-t/Ttlvc9LCRW624oSsFaP8EmswJ3OAn86QgF1dCUjAs="; |
11 | 9 | }; |
12 | 10 |
|
13 | 11 | in stdenv.mkDerivation rec { |
14 | 12 | pname = "gimx"; |
15 | | - version = "unstable-2021-08-31"; |
| 13 | + version = "8.0"; |
16 | 14 |
|
17 | 15 | src = fetchFromGitHub { |
18 | 16 | owner = "matlo"; |
19 | 17 | repo = "GIMX"; |
20 | | - rev = "58d2098dce75ed4c90ae649460d3a7a150f4ef0a"; |
| 18 | + rev = "v${version}"; |
21 | 19 | fetchSubmodules = true; |
22 | | - sha256 = "05kdv2qqr311c2p76hdlgvrq7b04vcpps5c80zn8b8l7p831ilgz"; |
| 20 | + hash = "sha256-BcFLdQgEAi6Sxyb5/P9YAIkmeXNZXrKcOa/6g817xQg="; |
23 | 21 | }; |
24 | 22 |
|
25 | | - patches = [ |
26 | | - ./conf.patch |
27 | | - |
28 | | - # gcc-13 build fixes: |
29 | | - # https://github.com/matlo/GIMX/pull/705 |
30 | | - (fetchpatch { |
31 | | - name = "gcc-13-headers.patch"; |
32 | | - url = "https://github.com/matlo/GIMX/commit/4525dff4d9af672116d8c6c182707f2ad6295b2d.patch"; |
33 | | - hash = "sha256-LkswnFsxqADooa09yO7Yf0AbxTrGfjBObyv/6FQJvRs="; |
34 | | - }) |
35 | | - (fetchpatch { |
36 | | - name = "gcc-13-protos.patch"; |
37 | | - url = "https://github.com/matlo/GIMX/commit/f11855fcb8bd9d0cb9c94871b4111ddfd5b610df.patch"; |
38 | | - hash = "sha256-JL67UUsEyPcOuaimJtMviiGLGghuq9665Lg1QuiaWUU="; |
39 | | - }) |
40 | | - ]; |
| 23 | + env.NIX_CFLAGS_COMPILE = "-Wno-error"; |
| 24 | + patches = [ ./conf.patch ./gcc14.patch ]; |
41 | 25 |
|
42 | 26 | nativeBuildInputs = [ makeWrapper ]; |
43 | | - buildInputs = [ |
44 | | - curl libusb1 bluez libxml2 ncurses5 libmhash |
45 | | - xorg.libX11 xorg.libXi xorg.libXext |
46 | | - ]; |
47 | | - |
48 | | - postPatch = lib.optionals gimxPdpGamepad '' |
49 | | - substituteInPlace ./shared/gimxcontroller/include/x360.h \ |
50 | | - --replace "0x045e" "0x0e6f" --replace "0x028e" "0x0213" |
51 | | - substituteInPlace ./loader/firmware/EMU360.hex \ |
52 | | - --replace "1B210001" "1B211001" \ |
53 | | - --replace "09210001" "09211001" \ |
54 | | - --replace "5E048E021001" "6F0E13020001" |
55 | | - ''; |
56 | | - |
| 27 | + buildInputs = [ curl libusb1 bluez libxml2 ncurses5 libmhash xorg.libX11 xorg.libXi ]; |
57 | 28 | makeFlags = [ "build-core" ]; |
58 | 29 |
|
59 | | - env.NIX_CFLAGS_COMPILE = toString [ |
60 | | - # Needed with GCC 12 |
61 | | - "-Wno-error=address" |
62 | | - "-Wno-error=deprecated-declarations" |
63 | | - "-Wno-error=use-after-free" |
64 | | - ]; |
65 | | - |
66 | 30 | installPhase = '' |
67 | 31 | runHook preInstall |
68 | 32 |
|
69 | 33 | mkdir -p $out |
70 | | - substituteInPlace ./core/Makefile --replace "chmod ug+s" "echo" |
71 | | -
|
| 34 | + substituteInPlace ./core/Makefile --replace-fail "chmod ug+s" "echo" |
72 | 35 | export DESTDIR="$out" |
73 | 36 | make install-shared install-core |
74 | 37 | mv $out/usr/lib $out/lib |
75 | 38 | mv $out/usr/bin $out/bin |
76 | | - rmdir $out/usr |
| 39 | + cp -r ${gimx-config}/Linux $out/share |
77 | 40 |
|
78 | | - runHook postInstall |
79 | | - ''; |
80 | | - |
81 | | - postInstall = '' |
82 | | - mkdir -p $out/share |
83 | | - cp -r ./loader/firmware $out/share/firmware |
84 | | - cp -r ${gimx-config}/Linux $out/share/config |
85 | | - cp -r ${./custom} $out/share/custom |
| 41 | + makeWrapper $out/bin/gimx $out/bin/gimx-ds4 \ |
| 42 | + --add-flags "--nograb" --add-flags "-p /dev/ttyUSB0" \ |
| 43 | + --add-flags "-c $out/share/Dualshock4.xml" |
86 | 44 |
|
87 | | - makeWrapper $out/bin/gimx $out/bin/gimx-dualshock4 \ |
88 | | - --set GIMXCONF 1 --add-flags "--nograb" --add-flags "-p /dev/ttyUSB0" \ |
89 | | - --add-flags "-c $out/share/custom/Dualshock4.xml" |
90 | | -
|
91 | | - makeWrapper $out/bin/gimx $out/bin/gimx-xboxonepad \ |
92 | | - --set GIMXCONF 1 --add-flags "--nograb" --add-flags "-p /dev/ttyUSB0" \ |
93 | | - --add-flags "-c $out/share/config/XOnePadUsb.xml" |
| 45 | + runHook postInstall |
94 | 46 | ''; |
95 | 47 |
|
96 | 48 | meta = with lib; { |
97 | 49 | homepage = "https://github.com/matlo/GIMX"; |
98 | 50 | description = "Game Input Multiplexer"; |
99 | 51 | license = licenses.gpl3Only; |
100 | 52 | platforms = platforms.linux; |
101 | | - maintainers = with maintainers; [ bb2020 ]; |
102 | 53 | }; |
103 | 54 | } |
0 commit comments