martin: 1.4.0 → 1.9.1 (#508728)

This commit is contained in:
Ivan Mincik
2026-05-17 19:59:33 +00:00
committed by GitHub
+64 -5
View File
@@ -2,28 +2,62 @@
lib,
stdenv,
fetchFromGitHub,
fetchurl,
buildNpmPackage,
rustPlatform,
pkg-config,
curl,
libz,
openssl,
postgresql,
postgresqlTestHook,
nix-update-script,
}:
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 +71,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 +97,11 @@ rustPlatform.buildRustPackage (finalAttrs: {
nativeBuildInputs = [ pkg-config ];
buildInputs = [ openssl ];
buildInputs = [
curl
libz
openssl
];
nativeCheckInputs = [
postgresql
@@ -84,6 +122,19 @@ rustPlatform.buildRustPackage (finalAttrs: {
};
};
env = {
MLN_PRECOMPILE = 1;
MLN_CORE_LIBRARY_PATH = "${mlnLibrary}/libmbgl-core-amalgam.a";
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/";
@@ -92,5 +143,13 @@ rustPlatform.buildRustPackage (finalAttrs: {
asl20
];
teams = [ lib.teams.geospatial ];
sourceProvenance = with lib.sourceTypes; [
binaryNativeCode # maplibre-native
fromSource
];
platforms = [
"aarch64-linux"
"x86_64-linux"
];
};
})