nur-packages

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

default.nix (1907B)


      1 {
      2   lib,
      3   stdenv,
      4   fetchFromGitHub,
      5   fetchwebarchive,
      6   fetchurl,
      7   unzip,
      8   mkgmap,
      9   mkgmap-splitter,
     10 }:
     11 let
     12   version = "250221";
     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-gLgIS7swuux5EsJzxdy3bJWMwC/utmQ262psaoqS3UY=";
     26   };
     27 in
     28 stdenv.mkDerivation (finalAttrs: {
     29   pname = "otm-armenia";
     30   inherit version;
     31 
     32   src = fetchFromGitHub {
     33     owner = "der-stefan";
     34     repo = "OpenTopoMap";
     35     rev = "e4467cfc2064afc379b0f8e8360db1740099cca3";
     36     hash = "sha256-3fymFZHFnivdgIWaJiRK6bvIRIay4+AnN1ns67lvq5I=";
     37   };
     38 
     39   sourceRoot = "${finalAttrs.src.name}/garmin";
     40 
     41   nativeBuildInputs = [
     42     mkgmap
     43     mkgmap-splitter
     44     unzip
     45   ];
     46 
     47   postPatch = ''
     48     unzip ${bounds} -d bounds
     49     unzip ${sea}
     50     mkdir data
     51   '';
     52 
     53   buildPhase = ''
     54     (cd data && splitter --precomp-sea=../sea --output=o5m ${armenia})
     55     (cd style/typ && mkgmap --family-id=35 opentopomap.txt)
     56 
     57     mkgmap \
     58       -c opentopomap_options \
     59       --style-file=style/opentopomap \
     60       --precomp-sea=sea \
     61       --output-dir=output \
     62       --bounds=bounds \
     63       data/6324*.o5m \
     64       style/typ/opentopomap.typ
     65   '';
     66 
     67   installPhase = ''
     68     install -Dm644 output/gmapsupp.img $out/otm-armenia.img
     69   '';
     70 
     71   meta = {
     72     description = "OpenTopoMap Garmin Edition";
     73     homepage = "https://garmin.opentopomap.org/";
     74     license = lib.licenses.free;
     75     maintainers = [ lib.maintainers.sikmir ];
     76     platforms = lib.platforms.all;
     77     skip.ci = true;
     78   };
     79 })