default.nix (1497B)
1 { 2 lib, 3 stdenvNoCC, 4 fetchurl, 5 unzip, 6 gdal, 7 elevation_server, 8 }: 9 let 10 version = "2014-05-25"; 11 12 dem1 = builtins.fromJSON (builtins.readFile ./dem1.json); 13 dem3 = builtins.fromJSON (builtins.readFile ./dem3.json); 14 15 meta = { 16 description = "Digital Elevation Data"; 17 homepage = "http://www.viewfinderpanoramas.org/"; 18 license = lib.licenses.free; 19 maintainers = [ lib.maintainers.sikmir ]; 20 platforms = lib.platforms.all; 21 skip.ci = true; 22 }; 23 in 24 { 25 vrt = stdenvNoCC.mkDerivation rec { 26 pname = "dem1-vrt"; 27 inherit version meta; 28 29 srcs = lib.mapAttrsToList (name: spec: fetchurl spec) dem1; 30 31 unpackPhase = lib.concatMapStringsSep "\n" (src: "unzip ${src}") srcs; 32 33 nativeBuildInputs = [ 34 unzip 35 gdal 36 ]; 37 38 dontFixup = true; 39 preferLocalBuild = true; 40 41 installPhase = '' 42 install -Dm644 **/*.hgt -t $out/hgt 43 gdalbuildvrt $out/SRTM1.vrt $out/hgt/*.hgt 44 ''; 45 }; 46 47 tiles = stdenvNoCC.mkDerivation rec { 48 pname = "dem3-tiles"; 49 inherit version meta; 50 51 # 1 arc-second hgt files are not supported by elevation_server 52 srcs = lib.mapAttrsToList (name: spec: fetchurl spec) dem3; 53 54 unpackPhase = lib.concatMapStringsSep "\n" (src: "unzip ${src}") srcs; 55 56 nativeBuildInputs = [ 57 unzip 58 elevation_server 59 ]; 60 61 dontFixup = true; 62 preferLocalBuild = true; 63 64 installPhase = '' 65 install -Dm644 **/*.hgt -t $out/hgt 66 make_data -hgt $out/hgt -out $out/dem_tiles 67 ''; 68 }; 69 }