nur-packages

My NUR packages
git clone git://git.sikmir.ru/nur-packages
Log | Files | Refs | README | LICENSE

package.nix (1936B)


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