summary refs log tree commit diff
path: root/maintainers/scripts/haskell/update-stackage.sh
diff options
context:
space:
mode:
authorMalte Brandy <malte.brandy@maralorn.de>2021-05-05 22:38:46 +0200
committerMalte Brandy <malte.brandy@maralorn.de>2021-05-07 21:58:08 +0200
commit7f236bd4b245b88c3111e627aa2654cb73be3d15 (patch)
tree48b42775395506a446dd871d0ff97da3faa834fc /maintainers/scripts/haskell/update-stackage.sh
parentd75130019b38ef8ceb2d62a5d868ea4a31242b6e (diff)
downloadnixpkgs-7f236bd4b245b88c3111e627aa2654cb73be3d15.tar
nixpkgs-7f236bd4b245b88c3111e627aa2654cb73be3d15.tar.gz
nixpkgs-7f236bd4b245b88c3111e627aa2654cb73be3d15.tar.bz2
nixpkgs-7f236bd4b245b88c3111e627aa2654cb73be3d15.tar.lz
nixpkgs-7f236bd4b245b88c3111e627aa2654cb73be3d15.tar.xz
nixpkgs-7f236bd4b245b88c3111e627aa2654cb73be3d15.tar.zst
nixpkgs-7f236bd4b245b88c3111e627aa2654cb73be3d15.zip
hackage2nix: Split configuration, auto disable hydra builds
We split configuration-hackage2nix.yaml into multiple files.  We bump
cabal2nix-unstable to get support for multiple config files in
hackage2nix.

* The file main.yaml is only supposed to be edited by humans.
* The file stackage.yaml is only supposed to be updated by the
  update-stackage.sh
* The file broken.yaml can be edited by humans, but probably future
  helpers will want to insert broken packages into this file based on
  hydra reports.
* The file transitive-broken.yaml is newly introduced to be generated
  by regenerate-transitive-broken-packages.sh

regenerate-transitive-broken-packages.sh makes a nix query (in
transitive-broken-packages.nix) which evaluates all haskellPackages
once with and once without "allowBroken" this way it get's a list of
packages which are broken by some transitive dependency, but does not
disable packages which have eval errors not caused by a broken package.
Diffstat (limited to 'maintainers/scripts/haskell/update-stackage.sh')
-rwxr-xr-xmaintainers/scripts/haskell/update-stackage.sh26
1 files changed, 12 insertions, 14 deletions
diff --git a/maintainers/scripts/haskell/update-stackage.sh b/maintainers/scripts/haskell/update-stackage.sh
index b332e8d4dc6..3d51ddc4338 100755
--- a/maintainers/scripts/haskell/update-stackage.sh
+++ b/maintainers/scripts/haskell/update-stackage.sh
@@ -1,17 +1,18 @@
-#! /usr/bin/env bash
+#! /usr/bin/env nix-shell
+#! nix-shell -i bash -p nix curl jq nix-prefetch-github git gnused gnugrep -I nixpkgs=.
 
 set -eu -o pipefail
 
 tmpfile=$(mktemp "update-stackage.XXXXXXX")
 # shellcheck disable=SC2064
 
-config_file="pkgs/development/haskell-modules/configuration-hackage2nix.yaml"
+stackage_config="pkgs/development/haskell-modules/configuration-hackage2nix/stackage.yaml"
 
 trap "rm ${tmpfile} ${tmpfile}.new" 0
 touch "$tmpfile" "$tmpfile.new" # Creating files here so that trap creates no errors.
 
 curl -L -s "https://stackage.org/nightly/cabal.config" >"$tmpfile"
-old_version=$(grep "  # Stackage Nightly" $config_file | sed -E 's/.*([0-9]{4}-[0-9]{2}-[0-9]{2}).*/\1/')
+old_version=$(grep "# Stackage Nightly" $stackage_config | sed -E 's/.*([0-9]{4}-[0-9]{2}-[0-9]{2}).*/\1/')
 version=$(sed -rn "s/^--.*http:..(www.)?stackage.org.snapshot.nightly-//p" "$tmpfile")
 
 if [[ "$old_version" == "$version" ]]; then
@@ -29,6 +30,13 @@ sed -r \
     -e '/^$/d' \
     < "${tmpfile}" | sort --ignore-case >"${tmpfile}.new"
 
+cat > $stackage_config << EOF
+# Stackage Nightly $version
+# This file is auto-generated by
+# maintainers/scripts/haskell/update-stackage.sh
+default-package-overrides:
+EOF
+
 # Drop restrictions on some tools where we always want the latest version.
 sed -r \
     -e '/ cabal-install /d' \
@@ -48,17 +56,7 @@ sed -r \
     -e '/ ShellCheck /d' \
     -e '/ stack /d' \
     -e '/ weeder /d' \
-    < "${tmpfile}.new" > "${tmpfile}"
-
-# Drop the previous configuration ...
-# shellcheck disable=SC1004
-sed -e '/  # Stackage Nightly/,/^$/c \TODO\
-'   -i $config_file
-
-# ... and replace it with the new one.
-sed -e "/TODO/r $tmpfile" \
-    -e "s/TODO/  # Stackage Nightly $version/" \
-    -i $config_file
+    < "${tmpfile}.new" >> $stackage_config
 
 if [[ "${1:-}" == "--do-commit" ]]; then
 git add $config_file