anchor.diff:      sconsFlags+=" python_libdir=$out/lib/${python3Packages.python.libPrefix}/site-packages"
     '';
   
  +  # - leapfetch=no disables going online at build time to fetch leap-seconds
  +  #   info. See <gpsd-src>/build.txt for more info.
     sconsFlags = [
       "leapfetch=no"
       "gpsd_user=${gpsdUser}"
  
positive.code: { stdenv, lib ,fetchurl, scons, pkg-config, dbus, ncurses
  , libusb1, docbook_xml_dtd_412, docbook_xsl, bc
  
  # optional deps for GUI packages
  , guiSupport ? true
  , dbus-glib ? null, libX11 ? null, libXt ? null, libXpm ? null, libXaw ? null, libXext ? null
  , gobject-introspection ? null, pango ? null, gdk-pixbuf ? null, atk ? null, wrapGAppsHook ? null
  
  , libxslt, xmlto, gpsdUser ? "gpsd", gpsdGroup ? "dialout"
  , pps-tools
  , python3Packages
  }:
  
  
  stdenv.mkDerivation rec {
    pname = "gpsd";
    version = "3.22";
  
    src = fetchurl {
      url = "mirror://savannah/${pname}/${pname}-${version}.tar.gz";
      sha256 = "18rplv1cd76ndb2wc91jarjmfm2nk508pykv1hir79bqbwmdygvq";
    };
  
    nativeBuildInputs = [
      scons pkg-config docbook_xml_dtd_412 docbook_xsl xmlto bc
      python3Packages.python
      python3Packages.wrapPython
    ]
    ++ lib.optionals guiSupport [ wrapGAppsHook gobject-introspection ];
  
    buildInputs = [
      python3Packages.python dbus ncurses
      libxslt libusb1 pps-tools
    ]
    ++ lib.optionals guiSupport [
      dbus-glib libX11 libXt libXpm libXaw libXext
      gobject-introspection pango gdk-pixbuf atk
    ];
  
    pythonPath = lib.optionals guiSupport [
  
negative.code:     '';
      homepage = "https://gpsd.gitlab.io/gpsd/index.html";
      changelog = "https://gitlab.com/gpsd/gpsd/-/blob/release-${version}/NEWS";
      license = licenses.bsd2;
      platforms = platforms.linux;
      maintainers = with maintainers; [ bjornfor rasendubi ];
    };
  