forked from NixOS/cabal2nix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-nixpkgs.sh
executable file
·46 lines (38 loc) · 1.07 KB
/
update-nixpkgs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#! /usr/bin/env bash
set -eu -o pipefail
exit_trap()
{
local lc="$BASH_COMMAND" rc=$?
test $rc -eq 0 || echo "*** error $rc: $lc"
}
trap exit_trap EXIT
cd "$(dirname "$0")"
cabal2nix=$(git rev-parse --verify HEAD)
cd nixpkgs
git reset -q --hard
git pull -q
export NIX_PATH=nixpkgs=$PWD
cd ..
cd hackage
# git reset -q --hard
git pull -q
DIR=$HOME/.cabal/packages/hackage.haskell.org
TAR=$DIR/00-index.tar
TARGZ=$TAR.gz
mkdir -p "$DIR"
rm -f "$TAR" "$TARGZ"
git archive --format=tar -o "$TAR" HEAD
gzip -k "$TAR"
hackage=$(git rev-parse --verify HEAD)
cd ..
rm -rf dist
make --quiet cabal2nix.cabal
cabal build -v0 -j hackage2nix
dist/build/hackage2nix/hackage2nix >hackage-packages.nix 2>/dev/null
cd nixpkgs
git pull -q
mv ../hackage-packages.nix pkgs/development/haskell-modules/hackage-packages.nix
if [ -n "$(git status --porcelain)" ]; then
git commit -q -m "hackage-packages.nix: update to https://github.com/commercialhaskell/all-cabal-files/commit/$hackage with hackage2nix revision $cabal2nix" -- pkgs/development/haskell-modules/hackage-packages.nix
git push -q
fi