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