nur-packages

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

commit 8fe66beb9c13276536abbc3cb791785ec58996a1
parent 18f306994deaaaabb004bcb16d0f3617d6f8a023
Author: Nikolay Korotkiy <sikmir@disroot.org>
Date:   Thu,  1 Sep 2022 21:22:09 +0300

Add overpassdb

Diffstat:
Dpkgs/data/misc/osm-extracts/default.nix | 36------------------------------------
Dpkgs/data/misc/routinodb/default.nix | 42------------------------------------------
Apkgs/data/osm/osm-extracts/default.nix | 42++++++++++++++++++++++++++++++++++++++++++
Apkgs/data/osm/overpassdb/default.nix | 26++++++++++++++++++++++++++
Apkgs/data/osm/routinodb/default.nix | 36++++++++++++++++++++++++++++++++++++
Mpkgs/default.nix | 6++++--
6 files changed, 108 insertions(+), 80 deletions(-)

diff --git a/pkgs/data/misc/osm-extracts/default.nix b/pkgs/data/misc/osm-extracts/default.nix @@ -1,36 +0,0 @@ -{ lib, stdenv, fetchurl, osmium-tool, region ? "RU-LEN" }: - -stdenv.mkDerivation rec { - pname = "osm-extracts-${region}"; - version = "220830"; - - src = fetchurl { - url = "https://download.geofabrik.de/russia/northwestern-fed-district-${version}.osm.pbf"; - hash = "sha256-kzn8Rs/ZRekHF5CJ5SZeY+q1s642o+ZSJdRhNvwutZw="; - }; - - dontUnpack = true; - - nativeBuildInputs = [ osmium-tool ]; - - buildPhase = '' - osmium tags-filter -o ${region}-boundary.osm $src r/ISO3166-2=${region} - osmium extract -p ${region}-boundary.osm $src --set-bounds -s simple -o ${region}.osm.pbf - osmium export ${region}-boundary.osm -o ${region}-boundary.geojson - osmium tags-filter -o ${region}-water.osm ${region}.osm.pbf a/natural=water - osmium export ${region}-water.osm -o ${region}-water.geojson - ''; - - installPhase = '' - install -Dm644 *.geojson *.osm *.osm.pbf -t $out - ''; - - meta = with lib; { - description = "Administrative boundaries (${region})"; - homepage = "https://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative"; - license = licenses.free; - maintainers = [ maintainers.sikmir ]; - platforms = platforms.all; - skip.ci = true; - }; -} diff --git a/pkgs/data/misc/routinodb/default.nix b/pkgs/data/misc/routinodb/default.nix @@ -1,42 +0,0 @@ -{ lib, stdenv, fetchurl, routino, prefix ? "Russia-NWFD" }: - -stdenv.mkDerivation rec { - pname = "routinodb"; - version = "220830"; - - srcs = [ - (fetchurl { - url = "https://download.geofabrik.de/russia/northwestern-fed-district-${version}.osm.pbf"; - hash = "sha256-kzn8Rs/ZRekHF5CJ5SZeY+q1s642o+ZSJdRhNvwutZw="; - }) - ]; - - dontUnpack = true; - - installPhase = '' - install -dm755 $out - - for src in $srcs; do - ${routino}/bin/planetsplitter \ - --dir=$out \ - --prefix=${prefix} \ - --tagging=${routino}/share/routino/tagging.xml \ - --parse-only --append $src - done - - ${routino}/bin/planetsplitter \ - --dir=$out \ - --prefix=${prefix} \ - --tagging=${routino}/share/routino/tagging.xml \ - --process-only - ''; - - meta = with lib; { - description = "Routino Database"; - homepage = "https://download.geofabrik.de/index.html"; - license = licenses.free; - maintainers = [ maintainers.sikmir ]; - platforms = platforms.all; - skip.ci = true; - }; -} diff --git a/pkgs/data/osm/osm-extracts/default.nix b/pkgs/data/osm/osm-extracts/default.nix @@ -0,0 +1,42 @@ +{ lib, stdenv, fetchurl, osmium-tool }: + +stdenv.mkDerivation rec { + pname = "osm-extracts"; + version = "220830"; + + src = fetchurl { + url = "https://download.geofabrik.de/russia/northwestern-fed-district-${version}.osm.pbf"; + hash = "sha256-kzn8Rs/ZRekHF5CJ5SZeY+q1s642o+ZSJdRhNvwutZw="; + }; + + dontUnpack = true; + + nativeBuildInputs = [ osmium-tool ]; + + buildPhase = '' + runHook preBuild + + for region in RU-{ARK,KO,KR,LEN,MUR,NEN,NGR,PSK,SPE,VLG}; do + osmium tags-filter -o $region-boundary.osm $src r/ISO3166-2=$region + osmium extract -p $region-boundary.osm $src --set-bounds -s simple -o $region.osm.pbf + osmium export $region-boundary.osm -o $region-boundary.geojson + osmium tags-filter -o $region-water.osm $region.osm.pbf a/natural=water + osmium export $region-water.osm -o $region-water.geojson + done + + runHook postBuild + ''; + + installPhase = '' + install -Dm644 *.geojson *.osm *.osm.pbf -t $out + ''; + + meta = with lib; { + description = "Administrative boundaries"; + homepage = "https://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative"; + license = licenses.free; + maintainers = [ maintainers.sikmir ]; + platforms = platforms.all; + skip.ci = true; + }; +} diff --git a/pkgs/data/osm/overpassdb/default.nix b/pkgs/data/osm/overpassdb/default.nix @@ -0,0 +1,26 @@ +{ lib, stdenv, fetchurl, osmctools, osm-3s, osm-extracts }: + +stdenv.mkDerivation rec { + pname = "overpassdb"; + inherit (osm-extracts) version; + + dontUnpack = true; + + nativeBuildInputs = [ osmctools osm-3s ]; + + installPhase = '' + install -dm755 $out + + osmconvert ${osm-extracts}/RU-LEN.osm.pbf --out-osm | \ + update_database --db-dir=$out --meta + ''; + + meta = with lib; { + description = "Overpass Database"; + license = licenses.free; + maintainers = [ maintainers.sikmir ]; + platforms = platforms.all; + skip.ci = true; + }; +} + diff --git a/pkgs/data/osm/routinodb/default.nix b/pkgs/data/osm/routinodb/default.nix @@ -0,0 +1,36 @@ +{ lib, stdenv, fetchurl, routino, osm-extracts, prefix ? "Russia-NWFD" }: + +stdenv.mkDerivation rec { + pname = "routinodb"; + inherit (osm-extracts) version; + + dontUnpack = true; + + nativeBuildInputs = [ routino ]; + + installPhase = '' + install -dm755 $out + + for region in RU-{ARK,KO,KR,LEN,MUR,NEN,NGR,PSK,SPE,VLG}; do + planetsplitter \ + --dir=$out \ + --prefix=${prefix} \ + --tagging=${routino}/share/routino/tagging.xml \ + --parse-only --append ${osm-extracts}/$region.osm.pbf + done + + planetsplitter \ + --dir=$out \ + --prefix=${prefix} \ + --tagging=${routino}/share/routino/tagging.xml \ + --process-only + ''; + + meta = with lib; { + description = "Routino Database"; + license = licenses.free; + maintainers = [ maintainers.sikmir ]; + platforms = platforms.all; + skip.ci = true; + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix @@ -53,9 +53,11 @@ lib.makeScope newScope ( usa-osm-topo-routable = callPackage ./data/maps/usa-osm-topo-routable { }; gadm = callPackage ./data/misc/gadm { }; - osm-extracts = callPackage ./data/misc/osm-extracts { }; poi = callPackage ./data/misc/poi { }; - routinodb = callPackage ./data/misc/routinodb { }; + + osm-extracts = callPackage ./data/osm/osm-extracts { }; + overpassdb = callPackage ./data/osm/overpassdb { }; + routinodb = callPackage ./data/osm/routinodb { }; goldendict-arc-dark-theme = callPackage ./data/themes/goldendict-themes/arc-dark-theme.nix { };