about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/misc/osm2pgsql
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/misc/osm2pgsql')
-rw-r--r--nixpkgs/pkgs/tools/misc/osm2pgsql/default.nix75
1 files changed, 75 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/misc/osm2pgsql/default.nix b/nixpkgs/pkgs/tools/misc/osm2pgsql/default.nix
new file mode 100644
index 000000000000..5f4ff20e5d9b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/misc/osm2pgsql/default.nix
@@ -0,0 +1,75 @@
+{ lib, stdenv
+, fetchFromGitHub
+, cmake
+, expat
+, fmt
+, proj
+, bzip2
+, zlib
+, boost
+, cimg
+, postgresql
+, withLuaJIT ? false
+, lua
+, luajit
+, libosmium
+, nlohmann_json
+, potrace
+, protozero
+, testers
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "osm2pgsql";
+  version = "1.9.0";
+
+  src = fetchFromGitHub {
+    owner = "openstreetmap";
+    repo = "osm2pgsql";
+    rev = finalAttrs.version;
+    hash = "sha256-ZIjT4uKJas5RgxcMSoR8hWCM9pdu3hSzWwfIn1ZvU8Y=";
+  };
+
+  postPatch = ''
+    # Remove bundled libraries
+    rm -r contrib
+  '';
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = [
+    boost
+    bzip2
+    cimg
+    expat
+    fmt
+    libosmium
+    nlohmann_json
+    postgresql
+    potrace
+    proj
+    protozero
+    zlib
+  ] ++ lib.optional withLuaJIT luajit
+    ++ lib.optional (!withLuaJIT) lua;
+
+  cmakeFlags = [
+    "-DEXTERNAL_LIBOSMIUM=ON"
+    "-DEXTERNAL_PROTOZERO=ON"
+    "-DEXTERNAL_FMT=ON"
+  ] ++ lib.optional withLuaJIT "-DWITH_LUAJIT:BOOL=ON";
+
+  installFlags = [ "install-gen" ];
+
+  passthru.tests.version = testers.testVersion {
+    package = finalAttrs.finalPackage;
+  };
+
+  meta = with lib; {
+    description = "OpenStreetMap data to PostgreSQL converter";
+    homepage = "https://osm2pgsql.org";
+    license = licenses.gpl2Plus;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ jglukasik das-g ];
+  };
+})