This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

pkgs.realwallpaper: inline nomads-cloud and grib2json

+82 -81
-24
pkgs/grib2json/package.nix
··· 1 - # Copied from stockholm krebs/5pkgs/simple/grib2json (cc283503). 2 - { 3 - stdenv, 4 - fetchzip, 5 - jre, 6 - }: 7 - 8 - stdenv.mkDerivation { 9 - name = "grib2json"; 10 - src = fetchzip { 11 - url = "https://github.com/krebs/grib2json-bin/archive/31efe677b40fe491c988d50f96b59b1b7e2d46f7.zip"; 12 - sha256 = "1h3yxg270bvac7kaqsbsv4f8nln1i03rfz4cm8cp7llhjj3s6a6b"; 13 - }; 14 - installPhase = '' 15 - mkdir -p $out/bin 16 - cp -r lib $out/ 17 - cat > $out/bin/grib2json << EOF 18 - #!/bin/sh 19 - set -x 20 - ${jre}/bin/java -jar $out/lib/grib2json-0.8.0-SNAPSHOT.jar "\$@" 21 - EOF 22 - chmod +x $out/bin/grib2json 23 - ''; 24 - }
-56
pkgs/nomads-cloud/package.nix
··· 1 - # Copied from stockholm krebs/5pkgs/simple/nomads-cloud (cc283503). 2 - { 3 - callPackage, 4 - writers, 5 - coreutils, 6 - curl, 7 - jq, 8 - findutils, 9 - imagemagick, 10 - }: 11 - let 12 - grib2json = callPackage ../grib2json/package.nix { }; 13 - in 14 - writers.writeDashBin "nomads-cloud" '' 15 - prefix=$(mktemp -d) 16 - grib_path=$prefix/clouds.grib 17 - json_path=$prefix/clouds.json 18 - pgm_path=$prefix/clouds.pgm 19 - png_path=$1 20 - 21 - mkdir -p "$prefix" 22 - 23 - date=$(${coreutils}/bin/date +%Y%m%d) 24 - for hour in 18 12 06 00; do 25 - url="https://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p25_1hr.pl?file=gfs.t''${hour}z.pgrb2.0p25.anl&lev_entire_atmosphere_%5C%28considered_as_a_single_layer%5C%29=on&var_CWAT=on&leftlon=-180&rightlon=180&toplat=90&bottomlat=-90&dir=%2Fgfs.''${date}%2F''${hour}%2Fatmos" 26 - echo "$url" 27 - ${curl}/bin/curl -fsS "$url" > "$grib_path" 28 - if [ "$?" -eq 0 ]; then 29 - break 30 - fi 31 - done 32 - ${grib2json}/bin/grib2json --data "$grib_path" > "$json_path" 33 - 34 - width=$(${jq}/bin/jq '.[0].header.nx' < "$json_path") 35 - height=$(${jq}/bin/jq '.[0].header.ny' < "$json_path") 36 - 37 - # The maximum gray value. Must be bigger than 0 and less than 65536. 38 - maxval=1000 39 - 40 - # pgm - Netpbm grayscale image format 41 - # http://netpbm.sourceforge.net/doc/pgm.html 42 - { 43 - echo P2 44 - echo "$width $height" 45 - echo "$maxval" 46 - cat "$json_path" | 47 - ${jq}/bin/jq --argjson maxval "$maxval" -c ' 48 - ((.[0].data[]) * $maxval | round) 49 - ' | 50 - ${findutils}/bin/xargs -n "$width" 51 - } > "$pgm_path" 52 - 53 - ${imagemagick}/bin/convert -roll +50% "$pgm_path" "$png_path" 54 - 55 - rm -r "$prefix" 56 - ''
+24
pkgs/realwallpaper/grib2json.nix
··· 1 + # Copied from stockholm krebs/5pkgs/simple/grib2json (cc283503). 2 + { 3 + stdenv, 4 + fetchzip, 5 + jre, 6 + }: 7 + 8 + stdenv.mkDerivation { 9 + name = "grib2json"; 10 + src = fetchzip { 11 + url = "https://github.com/krebs/grib2json-bin/archive/31efe677b40fe491c988d50f96b59b1b7e2d46f7.zip"; 12 + sha256 = "1h3yxg270bvac7kaqsbsv4f8nln1i03rfz4cm8cp7llhjj3s6a6b"; 13 + }; 14 + installPhase = '' 15 + mkdir -p $out/bin 16 + cp -r lib $out/ 17 + cat > $out/bin/grib2json << EOF 18 + #!/bin/sh 19 + set -x 20 + ${jre}/bin/java -jar $out/lib/grib2json-0.8.0-SNAPSHOT.jar "\$@" 21 + EOF 22 + chmod +x $out/bin/grib2json 23 + ''; 24 + }
+56
pkgs/realwallpaper/nomads-cloud.nix
··· 1 + # Copied from stockholm krebs/5pkgs/simple/nomads-cloud (cc283503). 2 + { 3 + callPackage, 4 + writers, 5 + coreutils, 6 + curl, 7 + jq, 8 + findutils, 9 + imagemagick, 10 + }: 11 + let 12 + grib2json = callPackage ./grib2json.nix { }; 13 + in 14 + writers.writeDashBin "nomads-cloud" '' 15 + prefix=$(mktemp -d) 16 + grib_path=$prefix/clouds.grib 17 + json_path=$prefix/clouds.json 18 + pgm_path=$prefix/clouds.pgm 19 + png_path=$1 20 + 21 + mkdir -p "$prefix" 22 + 23 + date=$(${coreutils}/bin/date +%Y%m%d) 24 + for hour in 18 12 06 00; do 25 + url="https://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p25_1hr.pl?file=gfs.t''${hour}z.pgrb2.0p25.anl&lev_entire_atmosphere_%5C%28considered_as_a_single_layer%5C%29=on&var_CWAT=on&leftlon=-180&rightlon=180&toplat=90&bottomlat=-90&dir=%2Fgfs.''${date}%2F''${hour}%2Fatmos" 26 + echo "$url" 27 + ${curl}/bin/curl -fsS "$url" > "$grib_path" 28 + if [ "$?" -eq 0 ]; then 29 + break 30 + fi 31 + done 32 + ${grib2json}/bin/grib2json --data "$grib_path" > "$json_path" 33 + 34 + width=$(${jq}/bin/jq '.[0].header.nx' < "$json_path") 35 + height=$(${jq}/bin/jq '.[0].header.ny' < "$json_path") 36 + 37 + # The maximum gray value. Must be bigger than 0 and less than 65536. 38 + maxval=1000 39 + 40 + # pgm - Netpbm grayscale image format 41 + # http://netpbm.sourceforge.net/doc/pgm.html 42 + { 43 + echo P2 44 + echo "$width $height" 45 + echo "$maxval" 46 + cat "$json_path" | 47 + ${jq}/bin/jq --argjson maxval "$maxval" -c ' 48 + ((.[0].data[]) * $maxval | round) 49 + ' | 50 + ${findutils}/bin/xargs -n "$width" 51 + } > "$pgm_path" 52 + 53 + ${imagemagick}/bin/convert -roll +50% "$pgm_path" "$png_path" 54 + 55 + rm -r "$prefix" 56 + ''
+2 -1
pkgs/realwallpaper/package.nix
··· 1 1 # Copied from stockholm krebs/5pkgs/simple/realwallpaper (cc283503). 2 + # nomads-cloud and grib2json are its stockholm dependencies, used only here. 2 3 { pkgs, callPackage }: 3 4 let 4 - nomads-cloud = callPackage ../nomads-cloud/package.nix { }; 5 + nomads-cloud = callPackage ./nomads-cloud.nix { }; 5 6 in 6 7 pkgs.writers.writeDashBin "generate-wallpaper" '' 7 8 set -euf