lol
1{ fetchurl, stdenv, scons, pythonFull, pkgconfig, dbus, dbus_glib
2, ncurses, libX11, libXt, libXpm, libXaw, libXext, makeWrapper
3, libusb1, docbook_xml_dtd_412, docbook_xsl, bc
4, libxslt, xmlto, gpsdUser ? "gpsd", gpsdGroup ? "dialout"
5}:
6
7# TODO: the 'xgps' program doesn't work: "ImportError: No module named gobject"
8# TODO: put the X11 deps behind a guiSupport parameter for headless support
9
10stdenv.mkDerivation rec {
11 name = "gpsd-3.10";
12
13 src = fetchurl {
14 url = "http://download-mirror.savannah.gnu.org/releases/gpsd/${name}.tar.gz";
15 sha256 = "0823hl5zgwnbgm0fq3i4z34lv76cpj0k6m0zjiygiyrxrz0w4vvh";
16 };
17
18 nativeBuildInputs = [
19 scons makeWrapper pkgconfig docbook_xml_dtd_412 docbook_xsl xmlto bc
20 pythonFull
21 ];
22
23 buildInputs = [
24 pythonFull dbus dbus_glib ncurses libX11 libXt libXpm libXaw libXext
25 libxslt libusb1
26 ];
27
28 patches = [
29 ./0001-Import-LD_LIBRARY_PATH-to-allow-running-scons-check-.patch
30 ./0002-Import-XML_CATALOG_FILES-to-be-able-to-validate-the-.patch
31 ];
32
33 # - leapfetch=no disables going online at build time to fetch leap-seconds
34 # info. See <gpsd-src>/build.txt for more info.
35 # - chrpath=no stops the build from using 'chrpath' (which we don't have).
36 # 'chrpath' is used to be able to run the tests from the source tree, but
37 # we use $LD_LIBRARY_PATH instead.
38 buildPhase = ''
39 patchShebangs .
40 mkdir -p "$out"
41 sed -e "s|python_lib_dir = .*|python_lib_dir = \"$out/lib/${pythonFull.libPrefix}/site-packages\"|" -i SConstruct
42 scons prefix="$out" leapfetch=no gpsd_user=${gpsdUser} gpsd_group=${gpsdGroup} \
43 systemd=yes udevdir="$out/lib/udev" chrpath=no
44 '';
45
46 doCheck = false;
47
48 checkPhase = ''
49 export LD_LIBRARY_PATH="$PWD"
50 scons check
51 '';
52
53 # TODO: the udev rules file and the hotplug script need fixes to work on NixOS
54 installPhase = ''
55 scons install
56 mkdir -p "$out/lib/udev/rules.d"
57 scons udev-install
58 '';
59
60 postInstall = "wrapPythonPrograms";
61
62 meta = with stdenv.lib; {
63 description = "GPS service daemon";
64 longDescription = ''
65 gpsd is a service daemon that monitors one or more GPSes or AIS
66 receivers attached to a host computer through serial or USB ports,
67 making all data on the location/course/velocity of the sensors
68 available to be queried on TCP port 2947 of the host computer. With
69 gpsd, multiple location-aware client applications (such as navigational
70 and wardriving software) can share access to receivers without
71 contention or loss of data. Also, gpsd responds to queries with a
72 format that is substantially easier to parse than the NMEA 0183 emitted
73 by most GPSes. The gpsd distribution includes a linkable C service
74 library, a C++ wrapper class, and a Python module that developers of
75 gpsd-aware applications can use to encapsulate all communication with
76 gpsd. Third-party client bindings for Java and Perl also exist.
77
78 Besides gpsd itself, the project provides auxiliary tools for
79 diagnostic monitoring and profiling of receivers and feeding
80 location-aware applications GPS/AIS logs for diagnostic purposes.
81 '';
82 homepage = http://catb.org/gpsd/;
83 license = "BSD-style";
84 platforms = platforms.linux;
85 maintainers = [ maintainers.bjornfor ];
86 };
87}