git.iko.soy/typeable/cabal2nix
on v2.1 help sign in
typeable/cabal2nix/update-stackage.sh
39 lines 1.1 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 -i "$tmpfile"
20# Drop restrictions on some tools where we always want the latest version.
21sed -r \
22 -e '/ cabal-install /d' \
23 -e '/ cabal2nix /d' \
24 -e '/ hindent /d' \
25 -e '/ hpack /d' \
26 -e '/ hoogle /d' \
27 -e '/ ShellCheck /d' \
28 -e '/ stack /d' \
29 -e '/ hledger/d' \
30 -i "$tmpfile"
32# Drop the previous configuration ...
33sed -e '/# LTS Haskell/,/^$/c \TODO\
34' -i nixpkgs/pkgs/development/haskell-modules/configuration-hackage2nix.yaml
36# ... and replace it with the new one.
37sed -e "/TODO/r $tmpfile" \
38 -e "s/TODO/ # LTS Haskell $version/" \
39 -i nixpkgs/pkgs/development/haskell-modules/configuration-hackage2nix.yaml