default.nix (1616B)
1 { lib, stdenv, fetchFromGitHub, fetchurl, unzip, mkgmap, mkgmap-splitter, osm-extracts }: 2 let 3 bounds = fetchurl { 4 url = "http://osm.thkukuk.de/data/bounds-20220909.zip"; 5 hash = "sha256-79zepbGXulWr2QGlFVcIMkzASlTg5DqOEPvx0jcWLYw="; 6 }; 7 sea = fetchurl { 8 url = "http://osm.thkukuk.de/data/sea-20220914001527.zip"; 9 hash = "sha256-ntafRbfMMnHy2IlhqKE/DaMinsu9NaXA41HhXb6YVf4="; 10 }; 11 in 12 stdenv.mkDerivation (finalAttrs: { 13 pname = "opentopomap"; 14 inherit (osm-extracts) version; 15 16 src = fetchFromGitHub { 17 owner = "der-stefan"; 18 repo = "OpenTopoMap"; 19 rev = "e4467cfc2064afc379b0f8e8360db1740099cca3"; 20 hash = "sha256-3fymFZHFnivdgIWaJiRK6bvIRIay4+AnN1ns67lvq5I="; 21 }; 22 23 sourceRoot = "${finalAttrs.src.name}/garmin"; 24 25 nativeBuildInputs = [ mkgmap mkgmap-splitter unzip ]; 26 27 postPatch = '' 28 unzip ${bounds} -d bounds 29 unzip ${sea} 30 mkdir data 31 ''; 32 33 buildPhase = '' 34 (cd data && splitter --precomp-sea=../sea --output=o5m ${osm-extracts.src}) 35 (cd style/typ && mkgmap --family-id=35 opentopomap.txt) 36 37 mkgmap \ 38 -c opentopomap_options \ 39 --style-file=style/opentopomap \ 40 --precomp-sea=sea \ 41 --output-dir=output \ 42 --bounds=bounds \ 43 data/6324*.o5m \ 44 style/typ/opentopomap.typ 45 ''; 46 47 installPhase = '' 48 install -Dm644 output/gmapsupp.img $out/otm-russia-nwfd.img 49 ''; 50 51 meta = with lib; { 52 description = "OpenTopoMap Garmin Edition"; 53 homepage = "https://garmin.opentopomap.org/"; 54 license = licenses.free; 55 maintainers = [ maintainers.sikmir ]; 56 platforms = platforms.all; 57 skip.ci = true; 58 }; 59 })