From cb468f8dc7e57bbcc8183aef22140867d4e55184 Mon Sep 17 00:00:00 2001 From: Ivan Mincik Date: Tue, 1 Jul 2025 12:44:56 +0200 Subject: [PATCH] nominatim-ui: rewrite packaging to add missing files * Rewrite packaging to add missing files which needs to be built by yarn * Drop usage of finalAttrs which is failing when used with mkYarnPackage --- pkgs/by-name/no/nominatim-ui/package.json | 48 +++++++++++++++++++++++ pkgs/by-name/no/nominatim-ui/package.nix | 42 +++++++++++++++++--- 2 files changed, 84 insertions(+), 6 deletions(-) create mode 100644 pkgs/by-name/no/nominatim-ui/package.json diff --git a/pkgs/by-name/no/nominatim-ui/package.json b/pkgs/by-name/no/nominatim-ui/package.json new file mode 100644 index 000000000000..05d40eb226e0 --- /dev/null +++ b/pkgs/by-name/no/nominatim-ui/package.json @@ -0,0 +1,48 @@ +{ + "name": "nominatim-ui", + "description": "Debug web interface for Nominatim geocoder", + "version": "3.7.1", + "license": "GPL-2.0", + "scripts": { + "build": "rollup -c", + "dev": "rollup -c -w", + "lint": "eslint --quiet *.js src/ test/", + "lint:fix": "eslint --fix *.js src/ test/", + "test": "rollup -c && mocha --recursive test/", + "start": "static-server dist" + }, + "devDependencies": { + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "^9.12.0", + "@rollup/plugin-commonjs": "^28.0", + "@rollup/plugin-node-resolve": "^16.0", + "eslint": "^9.0", + "eslint-config-prettier": "^10.1.2", + "eslint-plugin-import": "^2.22.1", + "eslint-plugin-mocha": "^11.0", + "eslint-plugin-prettier": "^5.2.6", + "eslint-plugin-security": "^3.0.1", + "eslint-plugin-svelte": "^3.5.0", + "fs-extra": "^11.0.0", + "globals": "^16.0.0", + "http": "^0.0.1-security", + "http-proxy": "^1.18.1", + "mocha": "^11.0", + "puppeteer": "^24.0", + "rollup": "^4.22.4", + "rollup-plugin-css-only": "^4.3.0", + "rollup-plugin-livereload": "^2.0.0", + "rollup-plugin-svelte": "^7.0.0", + "rollup-plugin-terser": "^7.0.0", + "static-server": "^2.2.1", + "svelte": "^5.0.0" + }, + "dependencies": { + "bootstrap": "^5.0.0", + "escape-html": "^1.0.3", + "leaflet": "1.9.4", + "leaflet-minimap": "^3.6.1", + "timeago.js": "^4.0.2" + }, + "type": "module" +} diff --git a/pkgs/by-name/no/nominatim-ui/package.nix b/pkgs/by-name/no/nominatim-ui/package.nix index f4b09e84694b..c6f143419663 100644 --- a/pkgs/by-name/no/nominatim-ui/package.nix +++ b/pkgs/by-name/no/nominatim-ui/package.nix @@ -1,28 +1,58 @@ { lib, - stdenv, fetchFromGitHub, + fetchYarnDeps, + mkYarnPackage, }: -stdenv.mkDerivation (finalAttrs: { +# Notes for the upgrade: +# * Download the tarball of the new version to use. +# * Replace new `package.json` here. +# * Update `version`+`hash` and rebuild. + +mkYarnPackage rec { pname = "nominatim-ui"; version = "3.7.1"; src = fetchFromGitHub { owner = "osm-search"; repo = "nominatim-ui"; - tag = "v${finalAttrs.version}"; + tag = "v${version}"; hash = "sha256-TliTWDKdIp7Z0uYw5P65i06NQAUNwNymUsSYrihVZFE="; }; + offlineCache = fetchYarnDeps { + yarnLock = "${src}/yarn.lock"; + hash = "sha256-IqwsXEd9RSJhkA4BONTJT4xYMTyG9+zddIpD47v6AFc="; + }; + + packageJSON = ./package.json; + + buildPhase = '' + runHook preBuild + + yarn --offline build + + runHook postBuild + ''; + + # Minimal configuration + # See https://nominatim.org/release-docs/latest/admin/Setup-Nominatim-UI/#installing-nominatim-ui + preInstall = '' + echo "Nominatim_Config.Nominatim_API_Endpoint='https://localhost/';" \ + > deps/nominatim-ui/dist/theme/config.theme.js + ''; + installPhase = '' runHook preInstall - cp --archive dist $out + cp --archive deps/nominatim-ui/dist $out runHook postInstall ''; + doDist = false; + meta = { description = "Debugging user interface for Nominatim geocoder"; homepage = "https://github.com/osm-search/nominatim-ui"; @@ -31,6 +61,6 @@ stdenv.mkDerivation (finalAttrs: { geospatial ngi ]; - changelog = "https://github.com/osm-search/nominatim-ui/releases/tag/v${finalAttrs.version}"; + changelog = "https://github.com/osm-search/nominatim-ui/releases/tag/v${version}"; }; -}) +}