about summary refs log tree commit diff
path: root/pkgs/servers/gpsd/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/servers/gpsd/default.nix')
-rw-r--r--pkgs/servers/gpsd/default.nix97
1 files changed, 65 insertions, 32 deletions
diff --git a/pkgs/servers/gpsd/default.nix b/pkgs/servers/gpsd/default.nix
index 25051167ca51..62fbd3337f7a 100644
--- a/pkgs/servers/gpsd/default.nix
+++ b/pkgs/servers/gpsd/default.nix
@@ -1,54 +1,87 @@
-{ fetchurl, stdenv, pythonPackages, pkgconfig, dbus, dbus_glib
+{ fetchurl, stdenv, scons, pythonFull, pkgconfig, dbus, dbus_glib
 , ncurses, libX11, libXt, libXpm, libXaw, libXext, makeWrapper
 , libusb1, docbook_xml_dtd_412, docbook_xsl, bc
-, libxslt, xmlto, gpsdUser ? "gpsd" }:
+, libxslt, xmlto, gpsdUser ? "gpsd", gpsdGroup ? "dialout"
+}:
+
+# TODO: the 'xgps' program doesn't work: "ImportError: No module named gobject"
+# TODO: put the X11 deps behind a guiSupport parameter for headless support
 
 stdenv.mkDerivation rec {
-  name = "gpsd-2.95";
+  name = "gpsd-3.10";
 
   src = fetchurl {
-    url = "http://download.berlios.de/gpsd/${name}.tar.gz";
-    sha256 = "1bjhyjg561kwp6zc2wg58njdvpnsj5yaa2slz8g3ga1176jl68w3";
+    url = "http://download-mirror.savannah.gnu.org/releases/gpsd/${name}.tar.gz";
+    sha256 = "0823hl5zgwnbgm0fq3i4z34lv76cpj0k6m0zjiygiyrxrz0w4vvh";
   };
 
-  nativeBuildInputs = [ makeWrapper pkgconfig docbook_xml_dtd_412 docbook_xsl
-    xmlto bc pythonPackages.wrapPython ];
+  nativeBuildInputs = [
+    scons makeWrapper pkgconfig docbook_xml_dtd_412 docbook_xsl xmlto bc
+    pythonFull
+  ];
 
-  pythonPath = [ pythonPackages.curses ];
+  buildInputs = [
+    pythonFull dbus dbus_glib ncurses libX11 libXt libXpm libXaw libXext
+    libxslt libusb1
+  ];
 
-  buildInputs = [ pythonPackages.python dbus dbus_glib ncurses libX11 libXt
-    libXpm libXaw libXext libxslt libusb1 ];
+  patches = [
+    ./0001-Import-LD_LIBRARY_PATH-to-allow-running-scons-check-.patch
+    ./0002-Import-XML_CATALOG_FILES-to-be-able-to-validate-the-.patch
+  ];
 
-  configureFlags = "--enable-static --enable-dbus --enable-gpsd-user=${gpsdUser}";
+  # - leapfetch=no disables going online at build time to fetch leap-seconds
+  #   info. See <gpsd-src>/build.txt for more info.
+  # - chrpath=no stops the build from using 'chrpath' (which we don't have).
+  #   'chrpath' is used to be able to run the tests from the source tree, but
+  #   we use $LD_LIBRARY_PATH instead.
+  buildPhase = ''
+    patchShebangs .
+    mkdir -p "$out"
+    sed -e "s|python_lib_dir = .*|python_lib_dir = \"$out/lib/${pythonFull.python.libPrefix}/site-packages\"|" -i SConstruct
+    scons prefix="$out" leapfetch=no gpsd_user=${gpsdUser} gpsd_group=${gpsdGroup} \
+        systemd=yes udevdir="$out/lib/udev" chrpath=no
+  '';
 
-  doCheck = true;
+  doCheck = false;
 
-  postInstall = "wrapPythonPrograms";
+  checkPhase = ''
+    export LD_LIBRARY_PATH="$PWD"
+    scons check
+  '';
+
+  # TODO: the udev rules file and the hotplug script need fixes to work on NixOS
+  installPhase = ''
+    scons install
+    mkdir -p "$out/lib/udev/rules.d"
+    scons udev-install
+  '';
 
-  meta = {
-    description = "`gpsd', a GPS service daemon";
+  postInstall = "wrapPythonPrograms";
 
+  meta = with stdenv.lib; {
+    description = "GPS service daemon";
     longDescription = ''
-      gpsd is a service daemon that monitors one or more GPSes
-      attached to a host computer through serial or USB ports, making
-      all data on the location/course/velocity of the sensors
-      available to be queried on TCP port 2947 of the host computer.
-      With gpsd, multiple GPS client applications (such as
-      navigational and wardriving software) can share access to GPSes
-      without contention or loss of data.  Also, gpsd responds to
-      queries with a format that is substantially easier to parse than
-      the NMEA 0183 emitted by most GPSes.  The gpsd distribution
-      includes a linkable C service library, a C++ wrapper class, and
-      a Python module that developers of gpsd-aware applications can
-      use to encapsulate all communication with gpsd.
+      gpsd is a service daemon that monitors one or more GPSes or AIS
+      receivers attached to a host computer through serial or USB ports,
+      making all data on the location/course/velocity of the sensors
+      available to be queried on TCP port 2947 of the host computer. With
+      gpsd, multiple location-aware client applications (such as navigational
+      and wardriving software) can share access to receivers without
+      contention or loss of data. Also, gpsd responds to queries with a
+      format that is substantially easier to parse than the NMEA 0183 emitted
+      by most GPSes. The gpsd distribution includes a linkable C service
+      library, a C++ wrapper class, and a Python module that developers of
+      gpsd-aware applications can use to encapsulate all communication with
+      gpsd. Third-party client bindings for Java and Perl also exist.
 
       Besides gpsd itself, the project provides auxiliary tools for
-      diagnostic monitoring and profiling of GPSes and feeding
-      GPS-aware applications GPS logs for diagnostic purposes.
+      diagnostic monitoring and profiling of receivers and feeding
+      location-aware applications GPS/AIS logs for diagnostic purposes.
     '';
-
-    homepage = http://gpsd.berlios.de/;
-
+    homepage = http://catb.org/gpsd/;
     license = "BSD-style";
+    platforms = platforms.linux;
+    maintainers = [ maintainers.bjornfor ];
   };
 }