1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 expat,
7 fmt_11,
8 proj,
9 bzip2,
10 cli11,
11 zlib,
12 boost,
13 libpq,
14 python3,
15 withLuaJIT ? false,
16 lua,
17 luajit,
18 libosmium,
19 nlohmann_json,
20 opencv,
21 potrace,
22 protozero,
23 testers,
24}:
25
26stdenv.mkDerivation (finalAttrs: {
27 pname = "osm2pgsql";
28 version = "2.1.1";
29
30 src = fetchFromGitHub {
31 owner = "osm2pgsql-dev";
32 repo = "osm2pgsql";
33 rev = finalAttrs.version;
34 hash = "sha256-5rENMcYCfHUdb4QsyOnnGe/qCbdYLoXI15e7OqJXit4=";
35 };
36
37 postPatch = ''
38 # Remove bundled libraries
39 rm -r contrib
40 '';
41
42 nativeBuildInputs = [ cmake ];
43
44 buildInputs = [
45 boost
46 bzip2
47 cli11
48 expat
49 fmt_11
50 libosmium
51 libpq
52 nlohmann_json
53 opencv
54 potrace
55 proj
56 protozero
57 (python3.withPackages (
58 p: with p; [
59 psycopg2
60 pyosmium
61 ]
62 ))
63 zlib
64 ]
65 ++ lib.optional withLuaJIT luajit
66 ++ lib.optional (!withLuaJIT) lua;
67
68 cmakeFlags = [
69 (lib.cmakeBool "EXTERNAL_LIBOSMIUM" true)
70 (lib.cmakeBool "EXTERNAL_PROTOZERO" true)
71 (lib.cmakeBool "EXTERNAL_FMT" true)
72 (lib.cmakeBool "WITH_LUAJIT" withLuaJIT)
73 ];
74
75 passthru.tests.version = testers.testVersion {
76 package = finalAttrs.finalPackage;
77 };
78
79 meta = {
80 description = "OpenStreetMap data to PostgreSQL converter";
81 homepage = "https://osm2pgsql.org";
82 license = lib.licenses.gpl2Plus;
83 platforms = lib.platforms.unix;
84 maintainers = with lib.maintainers; [
85 jglukasik
86 das-g
87 ];
88 teams = [ lib.teams.geospatial ];
89 };
90})