commit 6ae14dedb62850742239a8f10dcaef66bab63df6
parent 095bdf6263809c3b3d4c67bf4dd6956e3a92cae6
Author: Nikolay Korotkiy <sikmir@gmail.com>
Date: Tue, 25 Feb 2020 09:46:59 +0300
Add osm2mp
Diffstat:
3 files changed, 70 insertions(+), 0 deletions(-)
diff --git a/nix/sources.json b/nix/sources.json
@@ -345,6 +345,18 @@
"url": "https://github.com/btittelbach/openmtbmap_openvelomap_linux/archive/6d00e273d7391fae72fb7fd21859483db3e26c1a.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
+ "osm2mp": {
+ "branch": "master",
+ "description": "Convert Openstreetmap data to MP format",
+ "homepage": "https://github.com/liosha/osm2mp",
+ "owner": "liosha",
+ "repo": "osm2mp",
+ "rev": "748f93792ead174ad0e94a183a173ef3fcacf200",
+ "sha256": "0k525fzlcxih51hxvy24fhc12z4i0jvvd4lrfrlhjyhbx8x486v3",
+ "type": "tarball",
+ "url": "https://github.com/liosha/osm2mp/archive/748f93792ead174ad0e94a183a173ef3fcacf200.tar.gz",
+ "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
+ },
"pyephem": {
"branch": "master",
"builtin": false,
diff --git a/pkgs/default.nix b/pkgs/default.nix
@@ -61,6 +61,10 @@ lib.makeScope newScope (self: with self; {
openorienteering-mapper = libsForQt5.callPackage ./applications/openorienteering-mapper {
inherit sources;
};
+ osm2mp = perlPackages.callPackage ./tools/geo/osm2mp {
+ inherit sources;
+ inherit (perlPackages) GeoOpenstreetmapParser MatchSimple MathPolygon MathPolygonTree TreeR;
+ };
ptunnel = callPackage ./tools/networking/ptunnel { };
pyephem = python3Packages.callPackage ./development/python-modules/pyephem {
inherit sources;
diff --git a/pkgs/tools/geo/osm2mp/default.nix b/pkgs/tools/geo/osm2mp/default.nix
@@ -0,0 +1,54 @@
+{ lib, buildPerlPackage, sources, ConfigStd, EncodeLocale
+, FileSlurp, GeoOpenstreetmapParser, JSON, ListMoreUtils
+, LWPProtocolHttps, MatchSimple, MathPolygon, MathPolygonTree
+, TemplateToolkit, TextUnidecode, TreeR, YAML }:
+
+buildPerlPackage rec {
+ pname = "osm2mp";
+ version = lib.substring 0 7 src.rev;
+ src = sources.osm2mp;
+
+ outputs = [ "out" ];
+
+ propagatedBuildInputs = [
+ ConfigStd
+ EncodeLocale
+ FileSlurp
+ GeoOpenstreetmapParser
+ JSON
+ ListMoreUtils
+ LWPProtocolHttps
+ MatchSimple
+ MathPolygon
+ MathPolygonTree
+ TemplateToolkit
+ TextUnidecode
+ TreeR
+ YAML
+ ];
+
+ postPatch = ''
+ substituteInPlace osm2mp.pl \
+ --replace "\$Bin/cfg" "$out/share/osm2mp/cfg"
+ '';
+
+ preConfigure = ''
+ patchShebangs .
+ touch Makefile.PL
+ '';
+
+ installPhase = ''
+ install -Dm755 osm2mp.pl $out/bin/osm2mp
+ install -dm755 $out/share/osm2mp/cfg
+ cp -r cfg/* $out/share/osm2mp/cfg
+ install -dm755 $out/lib/perl5/site_perl
+ cp -r lib/* $out/lib/perl5/site_perl
+ '';
+
+ meta = with lib; {
+ inherit (src) description homepage;
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ sikmir ];
+ platforms = platforms.unix;
+ };
+}