1{ lib, stdenv, fetchFromGitHub, cmake, pkg-config
2, zlib, curl, protobuf, prime-server, boost, sqlite, libspatialite
3, luajit, geos39, python3, zeromq }:
4
5stdenv.mkDerivation rec {
6 pname = "valhalla";
7 version = "3.1.0";
8
9 src = fetchFromGitHub {
10 owner = "valhalla";
11 repo = "valhalla";
12 rev = version;
13 sha256 = "04vxvzy6hnhdvb9lh1p5vqzzi2drv0g4l2gnbdp44glipbzgd4dr";
14 fetchSubmodules = true;
15 };
16
17 # https://github.com/valhalla/valhalla/issues/2119
18 postPatch = ''
19 for f in valhalla/mjolnir/transitpbf.h \
20 src/mjolnir/valhalla_query_transit.cc; do
21 substituteInPlace $f --replace 'SetTotalBytesLimit(limit, limit)' \
22 'SetTotalBytesLimit(limit)'
23 done
24 '';
25
26 nativeBuildInputs = [ cmake pkg-config ];
27 buildInputs = [
28 zlib curl protobuf prime-server boost sqlite libspatialite
29 luajit geos39 python3 zeromq
30 ];
31
32 cmakeFlags = [
33 "-DENABLE_TESTS=OFF"
34 "-DENABLE_BENCHMARKS=OFF"
35 ];
36
37 postFixup = ''
38 substituteInPlace "$out"/lib/pkgconfig/libvalhalla.pc \
39 --replace '=''${prefix}//' '=/' \
40 --replace '=''${exec_prefix}//' '=/'
41 '';
42
43 meta = with lib; {
44 description = "Open Source Routing Engine for OpenStreetMap";
45 homepage = "https://valhalla.readthedocs.io/";
46 license = licenses.mit;
47 maintainers = [ maintainers.Thra11 ];
48 platforms = platforms.linux;
49 };
50}