1{ stdenv, lib, fetchFromGitHub, libX11, fixDarwinDylibNames }:
2
3stdenv.mkDerivation rec {
4 version = "0.2.3";
5 pname = "libspnav";
6
7 src = fetchFromGitHub {
8 owner = "FreeSpacenav";
9 repo = "libspnav";
10 rev = "${pname}-${version}";
11 sha256 = "098h1jhlj87axpza5zgy58prp0zn94wyrbch6x0s7q4mzh7dc8ba";
12 };
13
14 nativeBuildInputs = lib.optional stdenv.isDarwin fixDarwinDylibNames;
15 buildInputs = [ libX11 ];
16
17 patches = [
18 # Changes the socket path from /run/spnav.sock to $XDG_RUNTIME_DIR/spnav.sock
19 # to allow for a user service
20 ./configure-socket-path.patch
21 ];
22
23 configureFlags = [ "--disable-debug"];
24 makeFlags = [
25 "CC=${stdenv.cc.targetPrefix}cc"
26 "AR=${stdenv.cc.targetPrefix}ar"
27 ];
28
29 preInstall = ''
30 mkdir -p $out/{lib,include}
31 '';
32
33 meta = with lib; {
34 homepage = "https://spacenav.sourceforge.net/";
35 description = "Device driver and SDK for 3Dconnexion 3D input devices";
36 longDescription = "A free, compatible alternative, to the proprietary 3Dconnexion device driver and SDK, for their 3D input devices (called 'space navigator', 'space pilot', 'space traveller', etc)";
37 license = licenses.bsd3;
38 platforms = platforms.unix;
39 maintainers = with maintainers; [ sohalt ];
40 };
41}