on iko/ghcjs-patch-master help sign in
Add a script for updating the Hackage rev
commit12076ea8f0ecacabed677eed91163b675fdbb926 authorRodney Lorrimar <rodney.lorrimar@iohk.io> dateFri 8 Feb 2019, 10:45 (8 years ago) parent72cc37d
2 files changed+41
default.nix+5 scripts/update-hackage.nix+36
default.nix+5
@@ -86,6 +86,11 @@ let
8686 # Snapshots of Hackage and Stackage, converted to Nix expressions,
8787 # regularly updated.
8888 inherit hackage stackage;
89+
90+ # Scripts for keeping Hackage and Stackage up to date.
91+ maintainer-scripts = {
92+ update-hackage = self.callPackage ./scripts/update-hackage.nix {};
93+ };
8994 });
9095
9196in
scripts/update-hackage.nixnew file+36
@@ -0,0 +1,36 @@
1+{ stdenv, writeScriptBin, coreutils, git, nix-tools, cabal-install, nix-prefetch-git }:
2+
3+with stdenv.lib;
4+
5+writeScriptBin "update-hackage-nix" ''
6+ #!${stdenv.shell}
7+
8+ set -euo pipefail
9+
10+ export PATH="${makeBinPath [ coreutils git nix-tools cabal-install nix-prefetch-git ]}"
11+
12+ # Make sure the hackage index is recent.
13+ cabal new-update
14+
15+ if [ -d hackage.nix ]; then
16+ cd hackage.nix
17+ git pull --ff-only
18+ cd ..
19+ else
20+ git clone git@github.com:input-output-hk/hackage.nix.git
21+ fi
22+
23+ hackage-to-nix hackage.nix
24+
25+ cd hackage.nix
26+ git add .
27+ git commit --allow-empty -m "Automatic update for $(date)"
28+
29+ rev=$(git rev-parse HEAD)
30+
31+ git push
32+
33+ cd ..
34+
35+ nix-prefetch-git https://github.com/input-output-hk/hackage.nix.git --rev "$rev" | tee hackage-src.json
36+''