about summary refs log tree commit diff
path: root/pkgs/servers
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2022-03-28 13:28:19 +0200
committerGitHub <noreply@github.com>2022-03-28 13:28:19 +0200
commit7a0163c98e44a976f043257e3192f67fd5fa5ee5 (patch)
treea0800825d4e482bc0f28d2ac8e9775d85a7bf54f /pkgs/servers
parent8aa41aeaea77d1ad943abbbbaf0252b1a4cee81c (diff)
parentd7e9eb35e20efc5a56a564355e35ac4dbaf5f6d1 (diff)
Merge pull request #165183 from mausch/nominatim4
Diffstat (limited to 'pkgs/servers')
-rw-r--r--pkgs/servers/nominatim/default.nix68
1 files changed, 68 insertions, 0 deletions
diff --git a/pkgs/servers/nominatim/default.nix b/pkgs/servers/nominatim/default.nix
new file mode 100644
index 0000000000000..4b7f9e3e2577a
--- /dev/null
+++ b/pkgs/servers/nominatim/default.nix
@@ -0,0 +1,68 @@
+{ stdenv, lib, fetchFromGitHub, fetchurl
+, clang-tools, cmake, bzip2, zlib, expat, boost, git, pandoc, gzip
+, postgresql_12
+, python3, python3Packages, php
+}:
+
+let
+  countryGrid = fetchurl {
+    # Nominatim docs mention https://www.nominatim.org/data/country_grid.sql.gz but it's not a very good URL for pinning
+    url = "https://web.archive.org/web/20220323041006/https://nominatim.org/data/country_grid.sql.gz";
+    sha256 = "sha256-/mY5Oq9WF0klXOv0xh0TqEJeMmuM5QQJ2IxANRZd4Ek=";
+  };
+in
+stdenv.mkDerivation rec {
+  pname = "nominatim";
+  version = "4.0.1";
+
+  src = fetchFromGitHub {
+    owner = "osm-search";
+    repo = "Nominatim";
+    rev = "v${version}";
+    fetchSubmodules = true;
+    sha256 = "sha256-sKI/KBKveb5kAWJ7y1xw+ZF1thynr402rJhVjkIdFMo=";
+  };
+
+  nativeBuildInputs = [
+    cmake
+    clang-tools
+    git
+    pandoc
+    php
+  ];
+
+  buildInputs = [
+    bzip2
+    zlib
+    expat
+    boost
+    python3
+    # python3Packages.pylint  # We don't want to run pylint because the package could break on pylint bumps which is really annoying.
+    # python3Packages.pytest  # disabled since I can't get it to run tests anyway
+    # python3Packages.behave  # disabled since I can't get it to run tests anyway
+    postgresql_12
+  ];
+
+  propagatedBuildInputs = with python3Packages; [
+    pyyaml
+    python-dotenv
+    psycopg2
+    psutil
+    jinja2
+    PyICU
+    datrie
+  ];
+
+  postPatch = ''
+    mkdir -p ./data
+    ln -s ${countryGrid} ./data/country_osm_grid.sql.gz
+  '';
+
+  meta = with lib; {
+    description = "Search engine for OpenStreetMap data";
+    homepage = "https://nominatim.org/";
+    license = licenses.gpl2Plus;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.mausch ];
+  };
+}