default.nix (1806B)
1 { 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 fetchurl, 6 unzip, 7 mkgmap, 8 mkgmap-splitter, 9 }: 10 let 11 version = "241115"; 12 bounds = fetchurl { 13 url = "https://www.thkukuk.de/osm/data/bounds-20241025.zip"; 14 hash = "sha256-7VjO9EYVQ0IEmjR3SXxaTAT22zToHw9JPOVm0p5rF3M="; 15 }; 16 sea = fetchurl { 17 url = "https://www.thkukuk.de/osm/data/sea-20241114001517.zip"; 18 hash = "sha256-nWxxPtaqrNLz2UiiQhpfo2lEbIjcsOl5IPuYWWCASXs="; 19 }; 20 armenia = fetchurl { 21 url = "https://download.geofabrik.de/asia/armenia-${version}.osm.pbf"; 22 hash = "sha256-CI7D+YS8TPWR8EIOJROnFfUYeZZs48PYeJCd0t5vgDA="; 23 }; 24 in 25 stdenv.mkDerivation (finalAttrs: { 26 pname = "otm-armenia"; 27 inherit version; 28 29 src = fetchFromGitHub { 30 owner = "der-stefan"; 31 repo = "OpenTopoMap"; 32 rev = "e4467cfc2064afc379b0f8e8360db1740099cca3"; 33 hash = "sha256-3fymFZHFnivdgIWaJiRK6bvIRIay4+AnN1ns67lvq5I="; 34 }; 35 36 sourceRoot = "${finalAttrs.src.name}/garmin"; 37 38 nativeBuildInputs = [ 39 mkgmap 40 mkgmap-splitter 41 unzip 42 ]; 43 44 postPatch = '' 45 unzip ${bounds} -d bounds 46 unzip ${sea} 47 mkdir data 48 ''; 49 50 buildPhase = '' 51 (cd data && splitter --precomp-sea=../sea --output=o5m ${armenia}) 52 (cd style/typ && mkgmap --family-id=35 opentopomap.txt) 53 54 mkgmap \ 55 -c opentopomap_options \ 56 --style-file=style/opentopomap \ 57 --precomp-sea=sea \ 58 --output-dir=output \ 59 --bounds=bounds \ 60 data/6324*.o5m \ 61 style/typ/opentopomap.typ 62 ''; 63 64 installPhase = '' 65 install -Dm644 output/gmapsupp.img $out/otm-armenia.img 66 ''; 67 68 meta = { 69 description = "OpenTopoMap Garmin Edition"; 70 homepage = "https://garmin.opentopomap.org/"; 71 license = lib.licenses.free; 72 maintainers = [ lib.maintainers.sikmir ]; 73 platforms = lib.platforms.all; 74 skip.ci = true; 75 }; 76 })