mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-03 19:15:39 +00:00
7f236bd4b2
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.
69 lines
2 KiB
Bash
Executable file
69 lines
2 KiB
Bash
Executable file
#! /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
|
|
|
|
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" $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
|
|
echo "No new stackage version"
|
|
exit 0 # Nothing to do
|
|
fi
|
|
|
|
# Create a simple yaml version of the file.
|
|
sed -r \
|
|
-e '/^--/d' \
|
|
-e 's|^constraints:||' \
|
|
-e 's|^ +| - |' \
|
|
-e 's|,$||' \
|
|
-e '/installed$/d' \
|
|
-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' \
|
|
-e '/ cabal2nix /d' \
|
|
-e '/ cabal2spec /d' \
|
|
-e '/ distribution-nixpkgs /d' \
|
|
-e '/ git-annex /d' \
|
|
-e '/ hindent /d' \
|
|
-e '/ hledger/d' \
|
|
-e '/ hlint /d' \
|
|
-e '/ hoogle /d' \
|
|
-e '/ hopenssl /d' \
|
|
-e '/ jailbreak-cabal /d' \
|
|
-e '/ json-autotype/d' \
|
|
-e '/ language-nix /d' \
|
|
-e '/ shake /d' \
|
|
-e '/ ShellCheck /d' \
|
|
-e '/ stack /d' \
|
|
-e '/ weeder /d' \
|
|
< "${tmpfile}.new" >> $stackage_config
|
|
|
|
if [[ "${1:-}" == "--do-commit" ]]; then
|
|
git add $config_file
|
|
git commit -F - << EOF
|
|
Stackage Nightly: $old_version -> $version
|
|
|
|
This commit has been generated by maintainers/scripts/haskell/update-stackage.sh
|
|
EOF
|
|
fi
|