This repository has no description
0

Configure Feed

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

pkgs.realwallpaper: bump d3-celestial pin, add updateScript

+75 -5
+1 -1
pkgs/realwallpaper/grib2json.nix
··· 9 9 name = "grib2json"; 10 10 src = fetchzip { 11 11 url = "https://github.com/krebs/grib2json-bin/archive/31efe677b40fe491c988d50f96b59b1b7e2d46f7.zip"; 12 - sha256 = "1h3yxg270bvac7kaqsbsv4f8nln1i03rfz4cm8cp7llhjj3s6a6b"; 12 + hash = "sha256-yyijh5SQ0nMZqox8lweIwVKLHNl6aazmYWovcMTrfsA="; 13 13 }; 14 14 installPhase = '' 15 15 mkdir -p $out/bin
+9 -4
pkgs/realwallpaper/package.nix
··· 4 4 let 5 5 nomads-cloud = callPackage ./nomads-cloud.nix { }; 6 6 in 7 - pkgs.writers.writeDashBin "generate-wallpaper" '' 7 + (pkgs.writers.writeDashBin "generate-wallpaper" '' 8 8 set -euf 9 9 10 10 export PATH=${ ··· 287 287 } ./get_constellations.py 288 288 } ${ 289 289 pkgs.fetchurl { 290 - url = "https://raw.githubusercontent.com/ofrohn/d3-celestial/d2e20e104b86429d90ac8227a5b021262b45d75a/data/constellations.lines.json"; 291 - sha256 = "0g71fdrnxvxd6pcqvihj2q9iaynrl7px45kzw6qm1kymynz6ckr9"; 290 + url = "https://raw.githubusercontent.com/ofrohn/d3-celestial/7e720a3de062059d4c5400a379146a601d9010e0/data/constellations.lines.json"; 291 + hash = "sha256-KU9mvvXVz1Cx4X8W0u+h2XoVExYSxo3ZNa3vbnNz4Tw="; 292 292 } 293 293 } > constellations.arcs || : # seems like astropy doesn't want to convert from icrs to itrs anymore 294 294 ··· 366 366 } 367 367 368 368 main "$@" 369 - '' 369 + '').overrideAttrs 370 + (old: { 371 + passthru = (old.passthru or { }) // { 372 + updateScript = ./update.sh; 373 + }; 374 + })
+65
pkgs/realwallpaper/update.sh
··· 1 + #!/usr/bin/env bash 2 + set -euo pipefail 3 + 4 + # realwallpaper has no version of its own; it pins two upstream GitHub assets 5 + # by commit. Bump each to the head of its default branch and refresh its hash. 6 + # Run by update-pkgs from the flake root ($0 is a read-only store copy). 7 + attr=realwallpaper 8 + dir=pkgs/realwallpaper 9 + system=$(nix eval --raw --impure --expr 'builtins.currentSystem') 10 + build_attr=".#packages.$system.$attr" 11 + 12 + # file | owner/repo | branch | URL prefix up to (and excluding) the 40-char rev 13 + assets=( 14 + "$dir/grib2json.nix|krebs/grib2json-bin|master|https://github.com/krebs/grib2json-bin/archive/" 15 + "$dir/package.nix|ofrohn/d3-celestial|master|https://raw.githubusercontent.com/ofrohn/d3-celestial/" 16 + ) 17 + 18 + # The probe build is *expected* to fail (hash mismatch); `|| true` keeps 19 + # pipefail/errexit from turning that into an empty `got`. awk must not 20 + # `exit` early or tee dies of SIGPIPE and takes the pipeline with it. 21 + probe_hash() { 22 + { nix build --no-link "$build_attr" 2>&1 || true; } | tee /dev/stderr \ 23 + | awk '/got:/ && !seen { print $2; seen = 1 }' || true 24 + } 25 + 26 + changed=0 27 + for asset in "${assets[@]}"; do 28 + IFS='|' read -r file repo branch prefix <<<"$asset" 29 + prefix_re=${prefix//./\\.} 30 + 31 + old_rev=$(grep -oE "${prefix_re}[0-9a-f]{40}" "$file" | sed "s|^${prefix_re}||") 32 + new_rev=$(curl -fsSL "https://api.github.com/repos/$repo/commits/$branch" | jq -r .sha) 33 + if [ -z "$old_rev" ] || [ -z "$new_rev" ] || [ "$new_rev" = null ]; then 34 + echo "$attr: could not determine revisions for $repo (old='$old_rev' new='$new_rev')" >&2 35 + exit 1 36 + fi 37 + if [ "$old_rev" = "$new_rev" ]; then 38 + echo "$attr: $repo already at $new_rev" 39 + continue 40 + fi 41 + 42 + # Bump the rev and blank the hash that follows the URL: with the old hash in 43 + # place nix would reuse the cached FOD and "succeed" on stale content. 44 + sed -i \ 45 + -e "s|${prefix_re}${old_rev}|${prefix}${new_rev}|" \ 46 + -e "\|${prefix_re}${new_rev}|,\|hash = |s|hash = \"[^\"]*\"|hash = \"\"|" \ 47 + "$file" 48 + 49 + # Only this asset's hash is blank, so the first mismatch belongs to it. 50 + got=$(probe_hash) 51 + if [ -z "$got" ]; then 52 + echo "$attr: no hash mismatch reported for $repo" >&2 53 + exit 1 54 + fi 55 + sed -i "\|${prefix_re}${new_rev}|,\|hash = |s|hash = \"\"|hash = \"$got\"|" "$file" 56 + echo "$attr: $repo $old_rev → $new_rev ($got)" 57 + changed=1 58 + done 59 + 60 + if [ "$changed" = 0 ]; then 61 + echo "$attr: already up to date" 62 + exit 0 63 + fi 64 + 65 + nix build --no-link "$build_attr"