nominatim: 4.4.0 -> 5.1.0 (#417561)

This commit is contained in:
Ivan Mincik
2025-06-25 11:26:07 +02:00
committed by GitHub
3 changed files with 122 additions and 64 deletions
@@ -0,0 +1,62 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
hatchling,
psycopg,
pyicu,
python-dotenv,
pyyaml,
sqlalchemy,
}:
buildPythonPackage rec {
pname = "nominatim";
version = "5.1.0";
pyproject = true;
src = fetchFromGitHub {
owner = "osm-search";
repo = "Nominatim";
tag = "v${version}";
hash = "sha256-eMCXXPrUZvM4ju0mi1+f+LXhThCCCEH+HDz6lurw+Jo=";
};
postPatch = ''
# pyproject.toml tool.hatch.build.targets.sdist.exclude is not properly
# excluding config.py file.
# Fix FileExistsError: File already exists: ... nominatim_api/config.py
rm src/nominatim_api/config.py
# Change to package directory
cd packaging/nominatim-api
'';
build-system = [
hatchling
];
dependencies = [
psycopg
pyicu
python-dotenv
pyyaml
sqlalchemy
];
# Fails on: ModuleNotFoundError: No module named 'nominatim_db'
# pythonImportsCheck = [ "nominatim_api" ];
meta = {
description = "Search engine for OpenStreetMap data (API module)";
homepage = "https://nominatim.org/";
license = lib.licenses.gpl2Plus;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ mausch ];
teams = with lib.teams; [
geospatial
ngi
];
};
}
+58 -64
View File
@@ -1,89 +1,83 @@
{
stdenv,
lib,
fetchFromGitHub,
fetchurl,
clang-tools,
cmake,
bzip2,
zlib,
expat,
boost,
git,
pandoc,
nlohmann_json,
# Nominatim needs to be built with the same postgres version it will target
libpq,
python3,
php,
lua,
osm2pgsql,
python3Packages,
nominatim, # required for testVersion
testers,
}:
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
# Nominatim-db needs 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=";
hash = "sha256-/mY5Oq9WF0klXOv0xh0TqEJeMmuM5QQJ2IxANRZd4Ek=";
};
in
stdenv.mkDerivation rec {
python3Packages.buildPythonApplication rec {
pname = "nominatim";
version = "4.4.0";
version = "5.1.0";
pyproject = true;
src = fetchFromGitHub {
owner = "osm-search";
repo = "Nominatim";
rev = "v${version}";
fetchSubmodules = true;
hash = "sha256-GPMDbvTPl9SLpZi5gyRAPQ84NSTIRoSfGJeqWs1e9Oo=";
tag = "v${version}";
hash = "sha256-eMCXXPrUZvM4ju0mi1+f+LXhThCCCEH+HDz6lurw+Jo=";
};
nativeBuildInputs = [
cmake
clang-tools
git
pandoc
php
lua
];
buildInputs = [
bzip2
zlib
expat
boost
nlohmann_json
(python3.withPackages (
ps: with ps; [
pyyaml
python-dotenv
psycopg2
sqlalchemy
asyncpg
psutil
jinja2
pyicu
datrie
pyosmium
]
))
# 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
libpq
];
postPatch = ''
mkdir -p ./data
ln -s ${countryGrid} ./data/country_osm_grid.sql.gz
# Fix: FileExistsError: File already exists: ... nominatim_db/paths.py
# pyproject.toml tool.hatch.build.targets.sdist.exclude is not properly
# excluding paths.py file.
rm src/nominatim_db/paths.py
# Install country_osm_grid.sql.gz required for data import
cp ${countryGrid} ./data/country_osm_grid.sql.gz
# Change to package directory
cd packaging/nominatim-db
'';
meta = with lib; {
description = "Search engine for OpenStreetMap data";
build-system = with python3Packages; [
hatchling
];
dependencies = with python3Packages; [
nominatim-api
jinja2
psutil
psycopg
pyicu
python-dotenv
pyyaml
];
propagatedBuildInputs = [
osm2pgsql
];
pythonImportsCheck = [ "nominatim_db" ];
passthru = {
tests.version = testers.testVersion { package = nominatim; };
};
meta = {
description = "Search engine for OpenStreetMap data (DB, CLI)";
homepage = "https://nominatim.org/";
license = licenses.gpl2Plus;
platforms = platforms.unix;
maintainers = [ maintainers.mausch ];
license = lib.licenses.gpl2Plus;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ mausch ];
teams = with lib.teams; [
geospatial
ngi
];
mainProgram = "nominatim";
};
}
+2
View File
@@ -10284,6 +10284,8 @@ self: super: with self; {
nominal-api-protos = callPackage ../development/python-modules/nominal-api-protos { };
nominatim-api = callPackage ../by-name/no/nominatim/nominatim-api.nix { };
nonbloat-db = callPackage ../development/python-modules/nonbloat-db { };
noneprompt = callPackage ../development/python-modules/noneprompt { };