commit 0ed5232cf4142215056523a334a2f2a2449aef23
parent c7461826ffb360b2a8a2836d83e0b048d51b0e76
Author: Nikolay Korotkiy <sikmir@gmail.com>
Date: Fri, 24 Jan 2020 09:53:11 +0300
Add elevation
Diffstat:
3 files changed, 53 insertions(+), 0 deletions(-)
diff --git a/default.nix b/default.nix
@@ -34,6 +34,10 @@ in rec {
docker-reg-tool = callPackage ./pkgs/docker-reg-tool {
inherit (sources) docker-reg-tool;
};
+ elevation = python3Packages.callPackage ./pkgs/elevation {
+ inherit click;
+ inherit (sources) elevation;
+ };
embox = callPackage ./pkgs/embox {
inherit (sources) embox;
};
diff --git a/nix/sources.json b/nix/sources.json
@@ -59,6 +59,18 @@
"url": "https://github.com/byrnedo/docker-reg-tool/archive/c5e7ff63fa476cac1eed717d0aef238beb50c21c.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
+ "elevation": {
+ "branch": "master",
+ "description": "Python script to download global terrain digital elevation models, SRTM 30m DEM and SRTM 90m DEM.",
+ "homepage": "http://elevation.bopen.eu",
+ "owner": "bopen",
+ "repo": "elevation",
+ "rev": "d225fc388e2ab263f3b7657986349262a2ba1e4d",
+ "sha256": "08zywj3napl6sqdhm18q60riij4fr60slm3fql9917bxs4j3n17y",
+ "type": "tarball",
+ "url": "https://github.com/bopen/elevation/archive/d225fc388e2ab263f3b7657986349262a2ba1e4d.tar.gz",
+ "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
+ },
"embox": {
"branch": "master",
"description": "Modular and configurable OS for embedded applications",
diff --git a/pkgs/elevation/default.nix b/pkgs/elevation/default.nix
@@ -0,0 +1,37 @@
+{ lib, buildPythonApplication, fasteners, future, appdirs, click
+, gnumake, curl, unzip, gzip, gdal
+, pytest, pytest-mock, elevation }:
+
+buildPythonApplication rec {
+ pname = "elevation";
+ version = lib.substring 0 7 src.rev;
+ src = elevation;
+
+ propagatedBuildInputs = [ fasteners future appdirs click ];
+
+ postPatch = ''
+ for f in elevation/datasource.* \
+ elevation/util.py \
+ tests/test_*.py; do
+ substituteInPlace $f \
+ --replace "make " "${lib.getBin gnumake}/bin/make " \
+ --replace "curl " "${lib.getBin curl}/bin/curl " \
+ --replace "gunzip " "gunzip.t " \
+ --replace "unzip " "${lib.getBin unzip}/bin/unzip " \
+ --replace "gunzip.t " "${lib.getBin gzip}/bin/gunzip " \
+ --replace "gdal_translate " "${lib.getBin gdal}/bin/gdal_translate " \
+ --replace "gdalbuildvrt " "${lib.getBin gdal}/bin/gdalbuildvrt "
+ done
+ '';
+
+ checkInputs = [ pytest pytest-mock ];
+ checkPhase = "pytest";
+
+ meta = with lib; {
+ description = elevation.description;
+ homepage = elevation.homepage;
+ license = licenses.asl20;
+ maintainers = with maintainers; [ sikmir ];
+ platforms = platforms.unix;
+ };
+}