maintainers/scripts/haskell/regenerate-hackage-packages.sh: init
Introduces a script that can be used to update the Nix expressions for the Haskell package set. In service of that, also - introduces cabal2nix-latest, which pins the hackage2nix version used - changes all-cabal-hashes to use fetchFromGitHub - adds update-hackage.sh & update-cabal2nix-latest.sh & update-stackage.sh maintainer scripts
This commit is contained in:
21
maintainers/scripts/haskell/update-hackage.sh
Executable file
21
maintainers/scripts/haskell/update-hackage.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p nix curl jq nix-prefetch-github -I nixpkgs=.
|
||||
|
||||
# See regenerate-hackage-packages.sh for details on the purpose of this script.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
pin_file=pkgs/data/misc/hackage/pin.json
|
||||
current_commit="$(jq -r .commit $pin_file)"
|
||||
head_commit="$(curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/commercialhaskell/all-cabal-hashes/branches/hackage | jq -r .commit.sha)"
|
||||
|
||||
if [ "$current_commit" != "$head_commit" ]; then
|
||||
url="https://github.com/commercialhaskell/all-cabal-hashes/archive/$head_commit.tar.gz"
|
||||
hash="$(nix-prefetch-url "$url")"
|
||||
jq -n \
|
||||
--arg commit "$head_commit" \
|
||||
--arg hash "$hash" \
|
||||
--arg url "$url" \
|
||||
'{commit: $commit, url: $url, sha256: $hash}' \
|
||||
> $pin_file
|
||||
fi
|
||||
Reference in New Issue
Block a user