From 3fba3f30578694a31f9a7b902bda40813b839c31 Mon Sep 17 00:00:00 2001 From: Nikolay Korotkiy Date: Sat, 26 Jul 2025 13:55:16 +0400 Subject: [PATCH 1/2] =?UTF-8?q?martin:=200.9.1=20=E2=86=92=201.4.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkgs/by-name/ma/martin/dont-build-webui.patch | 21 ++++ pkgs/by-name/ma/martin/package.nix | 103 +++++++++++------- 2 files changed, 87 insertions(+), 37 deletions(-) create mode 100644 pkgs/by-name/ma/martin/dont-build-webui.patch diff --git a/pkgs/by-name/ma/martin/dont-build-webui.patch b/pkgs/by-name/ma/martin/dont-build-webui.patch new file mode 100644 index 000000000000..a0f1f40feee7 --- /dev/null +++ b/pkgs/by-name/ma/martin/dont-build-webui.patch @@ -0,0 +1,21 @@ +diff --git i/martin/build.rs w/martin/build.rs +index b463a8c..775a94d 100644 +--- i/martin/build.rs ++++ w/martin/build.rs +@@ -75,15 +75,11 @@ fn webui() { + copy_file_tree( + &martin_ui_dir, + &out_martin_ui_dir, +- &["dist", "node_modules"], ++ &["node_modules"], + ); + + println!("installing and building in {}", out_martin_ui_dir.display()); + static_files::NpmBuild::new(&out_martin_ui_dir) +- .install() +- .expect("npm install failed") +- .run("build") +- .expect("npm run build failed") + .target(out_martin_ui_dir.join("dist")) + .to_resource_dir() + .build() diff --git a/pkgs/by-name/ma/martin/package.nix b/pkgs/by-name/ma/martin/package.nix index dd2596a01ffe..27758c9b5d55 100644 --- a/pkgs/by-name/ma/martin/package.nix +++ b/pkgs/by-name/ma/martin/package.nix @@ -1,61 +1,90 @@ { lib, - rustPlatform, + stdenv, fetchFromGitHub, + buildNpmPackage, + rustPlatform, pkg-config, openssl, + postgresql, + postgresqlTestHook, }: -rustPlatform.buildRustPackage rec { +rustPlatform.buildRustPackage (finalAttrs: { pname = "martin"; - version = "0.9.1"; + version = "1.4.0"; src = fetchFromGitHub { owner = "maplibre"; repo = "martin"; - rev = "v${version}"; - hash = "sha256-Jq72aEwM5bIaVywmS3HetR6nnBZnr3oa9a/4ZbgeL9E="; + tag = "martin-v${finalAttrs.version}"; + hash = "sha256-wThCAR3SL454HyHAqbfGfUESPVTiOUMQDq37O/bjJbI="; }; - cargoHash = "sha256-595VKHLajoNinyv12J9qUi55hOcOFRgUeLlzvSdjESs="; + patches = [ ./dont-build-webui.patch ]; + + cargoHash = "sha256-6hPZ3Db6ezPmtBT4XClERiV+MCFZgNLTnZTOeCgRln8="; + + webui = buildNpmPackage { + pname = "martin-ui"; + inherit (finalAttrs) version doCheck; + + src = "${finalAttrs.src}/martin/martin-ui"; + + postPatch = '' + substituteInPlace src/App.tsx \ + --replace-warn "./assets" "$src/src/assets" + ln -sf ${finalAttrs.src}/demo/frontend/public/favicon.ico public/_/assets/favicon.ico + ''; + + npmDepsHash = "sha256-ay8r+gvUVzza0GeJvrmtaEvppIc4wWjrqPGrK8oT+lA="; + + buildPhase = '' + runHook preBuild + npm exec vite build + runHook postBuild + ''; + + checkPhase = '' + runHook preCheck + npm run test + runHook postCheck + ''; + + installPhase = '' + cp -r dist $out + ''; + }; + + preBuild = '' + rm -rf martin/martin-ui/dist + cp -r ${finalAttrs.webui} martin/martin-ui/dist + ''; nativeBuildInputs = [ pkg-config ]; buildInputs = [ openssl ]; - checkFlags = [ - "--skip=function_source_schemas" - "--skip=function_source_tile" - "--skip=function_source_tilejson" - "--skip=pg_get_function_tiles" - "--skip=pg_get_function_source_ok_rewrite" - "--skip=pg_get_function_source_ok" - "--skip=pg_get_composite_source_tile_minmax_zoom_ok" - "--skip=pg_get_function_source_query_params_ok" - "--skip=pg_get_composite_source_tile_ok" - "--skip=pg_get_catalog" - "--skip=pg_get_composite_source_ok" - "--skip=pg_get_health_returns_ok" - "--skip=pg_get_table_source_ok" - "--skip=pg_get_table_source_rewrite" - "--skip=pg_null_functions" - "--skip=utils::test_utils::tests::test_bad_os_str" - "--skip=utils::test_utils::tests::test_get_env_str" - "--skip=pg_get_table_source_multiple_geom_tile_ok" - "--skip=pg_get_table_source_tile_minmax_zoom_ok" - "--skip=pg_tables_feature_id" - "--skip=pg_get_table_source_tile_ok" - "--skip=table_source_schemas" - "--skip=tables_srid_ok" - "--skip=tables_tile_ok" - "--skip=table_source" - "--skip=tables_tilejson" - "--skip=tables_multiple_geom_ok" + nativeCheckInputs = [ + postgresql + postgresqlTestHook ]; + # Tests are time-consuming and moved to passthru.tests.withCheck. + doCheck = false; + + checkFlags = [ + # Requires docker + "--skip=test_nonexistent_tables_functions_generate_warning" + ]; + + passthru.tests = lib.optionalAttrs (!postgresqlTestHook.meta.broken) { + withCheck = finalAttrs.finalPackage.overrideAttrs { + doCheck = true; + }; + }; + meta = { - # Marked broken 2025-11-28 because it has failed on Hydra for at least one year. - broken = true; description = "Blazing fast and lightweight PostGIS vector tiles server"; homepage = "https://martin.maplibre.org/"; license = with lib.licenses; [ @@ -64,4 +93,4 @@ rustPlatform.buildRustPackage rec { ]; maintainers = with lib.maintainers; [ sikmir ]; }; -} +}) From e27430dc30fec1697c3a28890256cd8d88ff0f63 Mon Sep 17 00:00:00 2001 From: Nikolay Korotkiy Date: Sat, 26 Jul 2025 13:58:56 +0400 Subject: [PATCH 2/2] martin: add geospatial team --- pkgs/by-name/ma/martin/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/ma/martin/package.nix b/pkgs/by-name/ma/martin/package.nix index 27758c9b5d55..ddee160c3a13 100644 --- a/pkgs/by-name/ma/martin/package.nix +++ b/pkgs/by-name/ma/martin/package.nix @@ -91,6 +91,6 @@ rustPlatform.buildRustPackage (finalAttrs: { mit # or asl20 ]; - maintainers = with lib.maintainers; [ sikmir ]; + teams = [ lib.teams.geospatial ]; }; })