Commit baeedd62 authored by Ben Gamari's avatar Ben Gamari 🐢

Update cabal-hashes and add script to ease future updates

Thanks to vaibhavsagar for the update script [1].

[1] https://github.com/vaibhavsagar/experiments/blob/f3f807212b82f07485c3df041cd8d6236ecb94e2/bump-all-cabal-hashes/updater
parent 43991b1c
let rev = "e8e76bc26a994aee313e571dc4e6701398d17a42";
in
{
url = "https://github.com/commercialhaskell/all-cabal-hashes/archive/${rev}.tar.gz";
sha256 = "16rnyxqmr93ahml0fjfa6hmjpmx8sbpfdr52krd2sd6ic9n5p5ix";
}
......@@ -28,7 +28,15 @@ let
};
overrides = self: super: rec {
all-cabal-hashes = self.fetchurl (import ./all-cabal-hashes.nix);
# Use scripts/update-cabal-hashes.sh to update this
all-cabal-hashes =
let
versions = builtins.fromJSON (builtins.readFile ./scripts/cabal-hashes.json);
fetch = { owner, repo, rev, sha256, ... }: self.fetchurl {
inherit sha256;
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
};
in fetch versions;
# Should this be self?
ghcHEAD = ghc super;
......
{
"owner": "commercialhaskell",
"repo": "all-cabal-hashes",
"branch": "hackage",
"message": "Update from Hackage at 2019-07-29T18:23:42Z",
"rev": "8cb9e194879225aab2a35838b4ab4b53f85d8eb8",
"sha256": "1krylhakvipxy2yiiswy2jq0f1giczx3y9gy335kq5r84brpar3v"
}
#! /usr/bin/env nix-shell
#! nix-shell -i bash
#! nix-shell -p curl jq nix
set -eufo pipefail
FILE=scripts/cabal-hashes.json
OWNER=$(jq -r '.owner' < "$FILE")
REPO=$(jq -r '.repo' < "$FILE")
BRANCH=$(jq -r '.branch' < "$FILE")
JSON=$(curl "https://api.github.com/repos/$OWNER/$REPO/branches/$BRANCH")
REV=$(echo "$JSON" | jq -r '.commit.sha')
MESSAGE=$(echo "$JSON" | jq -r '.commit.commit.message')
SHA256=$(nix-prefetch-url "https://github.com/$OWNER/$REPO/archive/$REV.tar.gz")
TJQ=$(jq '{owner: $owner, repo: $repo, branch: $branch, message: $message, rev: $rev, sha256: $sha256}' \
--arg owner "$OWNER" \
--arg repo "$REPO" \
--arg branch "$BRANCH" \
--arg message "$MESSAGE" \
--arg rev "$REV" \
--arg sha256 "$SHA256" \
< "$FILE")
[[ $? == 0 ]] && echo "${TJQ}" >| "$FILE"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment