commit a6614868f6bb107d80770012a0e1ee1cc8ea4493
parent f28480735f64a9a8503652843b4a4a6ee1d16ea5
Author: Nikolay Korotkiy <sikmir@gmail.com>
Date: Fri, 7 Aug 2020 14:59:48 +0300
gpxsee-maps: add map filter
Diffstat:
1 file changed, 36 insertions(+), 7 deletions(-)
diff --git a/pkgs/data/maps/gpxsee-maps/default.nix b/pkgs/data/maps/gpxsee-maps/default.nix
@@ -1,31 +1,60 @@
-{ stdenv
+{ stdenvNoCC
+, lib
, sources
, maptilerApiKey ? ""
, mapboxApiKey ? ""
+, thunderforestApiKey ? ""
+, openrouteserviceApiKey ? ""
+, hereApiKey ? ""
+, mapsList ? [
+ "World/Asia/nakarte-*.xml"
+ "World/Europe/FI"
+ "World/Europe/RU"
+ "World/CyclOSM.xml"
+ "World/MapTiler.xml"
+ "World/Mapbox.xml"
+ "World/OpenStreetMap.xml"
+ "World/heidelberg.xml"
+ "World/here-*.xml"
+ "World/marshruty.ru.xml"
+ ]
}:
let
pname = "gpxsee-maps";
- date = stdenv.lib.substring 0 10 sources.gpxsee-maps.date;
+ date = lib.substring 0 10 sources.gpxsee-maps.date;
version = "unstable-" + date;
in
-stdenv.mkDerivation {
+stdenvNoCC.mkDerivation {
inherit pname version;
src = sources.gpxsee-maps;
postPatch = ''
substitute World/MapTiler.tpl World/MapTiler.xml \
--replace "insert-your-apikey-here" "${maptilerApiKey}"
+
substitute World/Mapbox.tpl World/Mapbox.xml \
--replace "insert-your-apikey-here" "${mapboxApiKey}"
+
+ substitute World/heidelberg.tpl World/heidelberg.xml \
+ --replace "insert-your-apikey-here" "${openrouteserviceApiKey}"
+
+ for m in World/Thundeforest-*.tpl; do
+ substitute $m $m.xml \
+ --replace "insert-your-apikey-here" "${thunderforestApiKey}"
+ done
+
+ for m in World/here-*.tpl; do
+ substitute $m $m.xml \
+ --replace "insert-your-apikey-here" "${hereApiKey}"
+ done
'';
installPhase = ''
- install -dm755 $out/share/gpxsee/maps
- cp -r World $out/share/gpxsee/maps
- find $out -name "*.tpl" | xargs rm
+ install -dm755 $out
+ cp -r ${toString mapsList} $out
'';
- meta = with stdenv.lib; {
+ meta = with lib; {
inherit (sources.gpxsee-maps) description homepage;
license = licenses.unlicense;
maintainers = [ maintainers.sikmir ];