forked from NixOS/cabal2nix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-nixpkgs.sh
executable file
·47 lines (38 loc) · 1.04 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
47
#! /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 describe --dirty)
cd nixpkgs
git reset -q --hard
git clean -dxf -q
git pull -q
export NIX_PATH=nixpkgs=$PWD
cd ..
cd hackage
git pull -q
rm -f preferred-versions
for n in */preferred-versions; do
cat >>preferred-versions "$n"
echo >>preferred-versions
done
hackage=$(git rev-parse --verify HEAD)
cd ..
# This command needs a recent development version of cabal-install. I don't
# think this works properly in version 2.0.0.0 already.
cabal -v0 new-run hackage2nix -- --nixpkgs="$PWD/nixpkgs" +RTS -M4G -RTS
cd nixpkgs
git add pkgs/development/haskell-modules
if [ -n "$(git status --porcelain)" ]; then
cat <<EOF | git commit -n -q -F -
hackage-packages.nix: automatic Haskell package set update
This update was generated by hackage2nix $cabal2nix from Hackage revision
https://github.com/commercialhaskell/all-cabal-hashes/commit/$hackage.
EOF
git push -q
fi