From 7fff33b50351ee0f53eb6cfdcbd186d45ad2d75f Mon Sep 17 00:00:00 2001 From: Nikolay Korotkiy Date: Fri, 10 Apr 2026 23:48:20 +0400 Subject: [PATCH 1/2] =?UTF-8?q?martin:=201.4.0=20=E2=86=92=201.9.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkgs/by-name/ma/martin/package.nix | 61 +++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/pkgs/by-name/ma/martin/package.nix b/pkgs/by-name/ma/martin/package.nix index ddee160c3a13..6a719c8abfff 100644 --- a/pkgs/by-name/ma/martin/package.nix +++ b/pkgs/by-name/ma/martin/package.nix @@ -2,28 +2,61 @@ lib, stdenv, fetchFromGitHub, + fetchurl, buildNpmPackage, rustPlatform, pkg-config, + curl, + libz, openssl, postgresql, postgresqlTestHook, }: +let + # check package.metadata.mln in https://github.com/maplibre/maplibre-native-rs/blob/main/Cargo.toml + mlnRelease = "core-9b6325a14e2cf1cc29ab28c1855ad376f1ba4903"; + mlnHeaders = fetchurl { + url = "https://github.com/maplibre/maplibre-native/releases/download/${mlnRelease}/maplibre-native-headers.tar.gz"; + hash = "sha256-VjVEc/+IZTBG9ixP/i7oeel+7gy3+DhSEOi2UDIqeLc="; + }; + mlnLibrary = fetchurl ( + let + sources = { + aarch64-linux = { + url = "https://github.com/maplibre/maplibre-native/releases/download/${mlnRelease}/libmaplibre-native-core-amalgam-linux-arm64-vulkan.a"; + hash = "sha256-PHFNdzcG3+kngZmziMccCTnwBUbtsS2RAUNkTyNYXmc"; + }; + x86_64-linux = { + url = "https://github.com/maplibre/maplibre-native/releases/download/${mlnRelease}/libmaplibre-native-core-amalgam-linux-x64-vulkan.a"; + hash = "sha256-T9H7NiXHv+hbMgOd5QetQzxjIX1Ufn6gNmBJJ/7Ha50="; + }; + }; + in + sources.${stdenv.hostPlatform.system} + // { + downloadToTemp = true; + recursiveHash = true; + postFetch = '' + install -Dm644 $downloadedFile $out/libmbgl-core-amalgam.a + ''; + } + ); +in rustPlatform.buildRustPackage (finalAttrs: { pname = "martin"; - version = "1.4.0"; + version = "1.9.1"; src = fetchFromGitHub { owner = "maplibre"; repo = "martin"; tag = "martin-v${finalAttrs.version}"; - hash = "sha256-wThCAR3SL454HyHAqbfGfUESPVTiOUMQDq37O/bjJbI="; + hash = "sha256-LaPRkmzTVNn3qKJjrDNz8bcSWXy5SubevfjGvb+JvUg="; }; patches = [ ./dont-build-webui.patch ]; - cargoHash = "sha256-6hPZ3Db6ezPmtBT4XClERiV+MCFZgNLTnZTOeCgRln8="; + cargoHash = "sha256-dOTlYQcn2TWtzhJNFf3cVyR5EOvjBgW3qgBReUlfjTg="; webui = buildNpmPackage { pname = "martin-ui"; @@ -37,7 +70,7 @@ rustPlatform.buildRustPackage (finalAttrs: { ln -sf ${finalAttrs.src}/demo/frontend/public/favicon.ico public/_/assets/favicon.ico ''; - npmDepsHash = "sha256-ay8r+gvUVzza0GeJvrmtaEvppIc4wWjrqPGrK8oT+lA="; + npmDepsHash = "sha256-kuLnRFubvmskSRg1Jmdw79oTt0jrzbjW64zhcKfcuX4="; buildPhase = '' runHook preBuild @@ -63,7 +96,11 @@ rustPlatform.buildRustPackage (finalAttrs: { nativeBuildInputs = [ pkg-config ]; - buildInputs = [ openssl ]; + buildInputs = [ + curl + libz + openssl + ]; nativeCheckInputs = [ postgresql @@ -84,6 +121,12 @@ rustPlatform.buildRustPackage (finalAttrs: { }; }; + env = { + MLN_PRECOMPILE = 1; + MLN_CORE_LIBRARY_PATH = "${mlnLibrary}/libmbgl-core-amalgam.a"; + MLN_CORE_LIBRARY_HEADERS_PATH = "${mlnHeaders}"; + }; + meta = { description = "Blazing fast and lightweight PostGIS vector tiles server"; homepage = "https://martin.maplibre.org/"; @@ -92,5 +135,13 @@ rustPlatform.buildRustPackage (finalAttrs: { asl20 ]; teams = [ lib.teams.geospatial ]; + sourceProvenance = with lib.sourceTypes; [ + binaryNativeCode # maplibre-native + fromSource + ]; + platforms = [ + "aarch64-linux" + "x86_64-linux" + ]; }; }) From 456ab429bb599f918afbf853808e3b299e56e2ed Mon Sep 17 00:00:00 2001 From: Nikolay Korotkiy Date: Thu, 30 Apr 2026 17:23:00 +0400 Subject: [PATCH 2/2] martin: add updateScript --- pkgs/by-name/ma/martin/package.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/by-name/ma/martin/package.nix b/pkgs/by-name/ma/martin/package.nix index 6a719c8abfff..fcc5984cb08a 100644 --- a/pkgs/by-name/ma/martin/package.nix +++ b/pkgs/by-name/ma/martin/package.nix @@ -11,6 +11,7 @@ openssl, postgresql, postgresqlTestHook, + nix-update-script, }: let @@ -127,6 +128,13 @@ rustPlatform.buildRustPackage (finalAttrs: { MLN_CORE_LIBRARY_HEADERS_PATH = "${mlnHeaders}"; }; + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version-regex=martin-v(.*)" + "--subpackage=webui" + ]; + }; + meta = { description = "Blazing fast and lightweight PostGIS vector tiles server"; homepage = "https://martin.maplibre.org/";