1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 pkg-config,
7 boost,
8 curl,
9 cxxopts,
10 gdal,
11 geos,
12 libspatialite,
13 luajit,
14 lz4,
15 prime-server,
16 protobuf,
17 python3,
18 rapidjson,
19 sqlite,
20 zeromq,
21 zlib,
22 testers,
23}:
24
25stdenv.mkDerivation (finalAttrs: {
26 pname = "valhalla";
27 version = "3.5.1";
28
29 src = fetchFromGitHub {
30 owner = "valhalla";
31 repo = "valhalla";
32 tag = finalAttrs.version;
33 hash = "sha256-v/EwoJA1j8PuF9jOsmxQL6i+MT0rXbyLUE4HvBHUWDo=";
34 fetchSubmodules = true;
35 };
36
37 postPatch = ''
38 substituteInPlace src/bindings/python/CMakeLists.txt \
39 --replace-fail "\''${Python_SITEARCH}" "${placeholder "out"}/${python3.sitePackages}"
40 substituteInPlace CMakeLists.txt \
41 --replace-fail "rapidjson_include_dir rapidjson" "rapidjson_include_dir RapidJSON"
42 '';
43
44 nativeBuildInputs = [
45 cmake
46 pkg-config
47 ];
48
49 cmakeFlags = [
50 (lib.cmakeBool "BUILD_SHARED_LIBS" true)
51 (lib.cmakeBool "ENABLE_TESTS" false)
52 (lib.cmakeBool "ENABLE_SINGLE_FILES_WERROR" false)
53 (lib.cmakeBool "PREFER_EXTERNAL_DEPS" true)
54 ];
55
56 buildInputs = [
57 boost
58 cxxopts
59 lz4
60 (python3.withPackages (ps: [ ps.pybind11 ]))
61 rapidjson
62 zeromq
63 ];
64
65 propagatedBuildInputs = [
66 curl
67 gdal
68 geos
69 libspatialite
70 luajit
71 prime-server
72 protobuf
73 sqlite
74 zlib
75 ];
76
77 passthru.tests = {
78 pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
79 };
80
81 meta = with lib; {
82 changelog = "https://github.com/valhalla/valhalla/blob/${finalAttrs.src.rev}/CHANGELOG.md";
83 description = "Open Source Routing Engine for OpenStreetMap";
84 homepage = "https://valhalla.readthedocs.io/";
85 license = licenses.mit;
86 maintainers = [ maintainers.Thra11 ];
87 pkgConfigModules = [ "libvalhalla" ];
88 platforms = platforms.linux;
89 };
90})