git.iko.soy/typeable/cabal2nix
on v2.4.1 help sign in
typeable/cabal2nix/update-stackage.sh
48 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 -i "$tmpfile"
20# Drop restrictions on some tools where we always want the latest version.
21sed -r \
22 -e '/ cabal2nix /d' \
23 -e '/ cabal-install /d' \
24 -e '/ distribution-nixpkgs /d' \
25 -e '/ hindent /d' \
26 -e '/ hledger/d' \
27 -e '/ hoogle /d' \
28 -e '/ hopenssl /d' \
29 -e '/ hpack /d' \
30 -e '/ language-nix /d' \
31 -e '/ ShellCheck /d' \
32 -e '/ stack /d' \
33 -i "$tmpfile"
35# Drop packages which have broken metadata in the stupid all-cabal-hashes
36# repository. We need to drop our dependency on that thing ASAP.
37sed -r \
38 -e '/wai-middleware-prometheus ==0.2.0/d' \
39 -i "$tmpfile"
41# Drop the previous configuration ...
42sed -e '/# LTS Haskell/,/^$/c \TODO\
43' -i nixpkgs/pkgs/development/haskell-modules/configuration-hackage2nix.yaml
45# ... and replace it with the new one.
46sed -e "/TODO/r $tmpfile" \
47 -e "s/TODO/ # LTS Haskell $version/" \
48 -i nixpkgs/pkgs/development/haskell-modules/configuration-hackage2nix.yaml