1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 makeWrapper,
6 curl,
7 libusb1,
8 bluez,
9 libxml2,
10 ncurses5,
11 libmhash,
12 xorg,
13}:
14
15let
16 gimx-config = fetchFromGitHub {
17 owner = "matlo";
18 repo = "GIMX-configurations";
19 rev = "c20300f24d32651d369e2b27614b62f4b856e4a0";
20 hash = "sha256-t/Ttlvc9LCRW624oSsFaP8EmswJ3OAn86QgF1dCUjAs=";
21 };
22
23in
24stdenv.mkDerivation rec {
25 pname = "gimx";
26 version = "8.0";
27
28 src = fetchFromGitHub {
29 owner = "matlo";
30 repo = "GIMX";
31 rev = "v${version}";
32 fetchSubmodules = true;
33 hash = "sha256-BcFLdQgEAi6Sxyb5/P9YAIkmeXNZXrKcOa/6g817xQg=";
34 };
35
36 env.NIX_CFLAGS_COMPILE = "-Wno-error";
37 patches = [ ./conf.patch ];
38 makeFlags = [ "build-core" ];
39
40 nativeBuildInputs = [ makeWrapper ];
41 buildInputs = [
42 curl
43 libusb1
44 bluez
45 libxml2
46 ncurses5
47 libmhash
48 xorg.libX11
49 xorg.libXi
50 ];
51
52 installPhase = ''
53 runHook preInstall
54
55 mkdir -p $out
56 substituteInPlace ./core/Makefile --replace-fail "chmod ug+s" "echo"
57 export DESTDIR="$out"
58 make install-shared install-core
59 mv $out/usr/lib $out/lib
60 mv $out/usr/bin $out/bin
61 cp -r ${gimx-config}/Linux $out/share
62
63 makeWrapper $out/bin/gimx $out/bin/gimx-ds4 \
64 --add-flags "--nograb" --add-flags "-p /dev/ttyUSB0" \
65 --add-flags "-c $out/share/Dualshock4.xml"
66
67 runHook postInstall
68 '';
69
70 meta = {
71 homepage = "https://github.com/matlo/GIMX";
72 description = "Game Input Multiplexer";
73 license = lib.licenses.gpl3Only;
74 platforms = lib.platforms.linux;
75 };
76}