git.iko.soy/typeable/cabal2nix
on v2.10.1 help sign in
typeable/cabal2nix/update-stackage.sh
49 lines 1.4 kB history raw
1#! /usr/bin/env bash
3set -eu -o pipefail
5tmpfile=$(mktemp "stackage-update.XXXXXXX")
6trap "rm $tmpfile" 0
8curl -L -s "https://www.stackage.org/lts/cabal.config" >"$tmpfile"
9version=$(sed -n "s/^--.*http:..www.stackage.org.snapshot.lts-//p" "$tmpfile")
11# Create a simple yaml version of the file.
12sed -r \
13 -e '/^--/d' \
14 -e 's|^constraints:||' \
15 -e 's|^ +| - |' \
16 -e 's|,$||' \
17 -e '/installed$/d' \
18 -e '/^$/d' \
19 -i "$tmpfile"
21# Drop restrictions on some tools where we always want the latest version.
22sed -r \
23 -e '/ cabal-install /d' \
24 -e '/ cabal2nix /d' \
25 -e '/ distribution-nixpkgs /d' \
26 -e '/ git-annex /d' \
27 -e '/ hindent /d' \
28 -e '/ hledger/d' \
29 -e '/ hlint /d' \
30 -e '/ hoogle /d' \
31 -e '/ hopenssl /d' \
32 -e '/ jailbreak-cabal /d' \
33 -e '/ json-autotype/d' \
34 -e '/ lambdabot-core /d' \
35 -e '/ lambdabot-irc-plugins /d' \
36 -e '/ language-nix /d' \
37 -e '/ ShellCheck /d' \
38 -e '/ stack /d' \
39 -e '/ weeder /d' \
40 -i "$tmpfile"
42# Drop the previous configuration ...
43sed -e '/# LTS Haskell/,/^$/c \TODO\
44' -i nixpkgs/pkgs/development/haskell-modules/configuration-hackage2nix.yaml
46# ... and replace it with the new one.
47sed -e "/TODO/r $tmpfile" \
48 -e "s/TODO/ # LTS Haskell $version/" \
49 -i nixpkgs/pkgs/development/haskell-modules/configuration-hackage2nix.yaml