Something went wrong. Try again.
What happens if I push all of nixpkgs
Something went wrong. Try again.
2.9 kB · 88 lines
Shell
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889#! /usr/bin/env nix-shell#! nix-shell -i bash -p curl jq git gnused gnugrep -I nixpkgs=.# shellcheck shell=bash
set -eu -o pipefail
# Stackage solver to use, LTS or Nightly# (should be capitalized like the display name)SOLVER=LTS# Stackage solver verson, if any. Use latest if emptyVERSION=TMP_TEMPLATE=update-stackage.XXXXXXXreadonly SOLVERreadonly VERSIONreadonly TMP_TEMPLATE
toLower() { printf "%s" "$1" | tr '[:upper:]' '[:lower:]'}
tmpfile=$(mktemp "$TMP_TEMPLATE")tmpfile_new=$(mktemp "$TMP_TEMPLATE")
stackage_config="pkgs/development/haskell-modules/configuration-hackage2nix/stackage.yaml"
trap 'rm "${tmpfile}" "${tmpfile_new}"' 0touch "$tmpfile" "$tmpfile_new" # Creating files here so that trap creates no errors.
curl -L -s "https://stackage.org/$(toLower "$SOLVER")${VERSION:+-$VERSION}/cabal.config" >"$tmpfile"old_version=$(grep '^# Stackage' $stackage_config | sed -e 's/.\+ \([A-Za-z]\+ [0-9.-]\+\)$/\1/g')version="$SOLVER $(sed -rn "s/^--.*http:..(www.)?stackage.org.snapshot.$(toLower "$SOLVER")-//p" "$tmpfile")"
if [[ "$old_version" == "$version" ]]; then echo "No new stackage version" exit 0 # Nothing to dofi
echo "Updating Stackage from $old_version to $version."
# Create a simple yaml version of the file.sed -r \ -e '/^--/d' \ -e 's|^constraints:||' \ -e 's|^ +| - |' \ -e 's|,$||' \ -e '/^with-compiler:/d' \ -e '/installed$/d' \ -e '/^$/d' \ < "${tmpfile}" | LC_ALL=C.UTF-8 sort --ignore-case >"${tmpfile_new}"
cat > $stackage_config << EOF# Stackage $version# This file is auto-generated by# maintainers/scripts/haskell/update-stackage.shdefault-package-overrides:EOF
# Drop restrictions on some tools where we always want the latest version.sed -r \ -e '/ cabal2nix /d' \ -e '/ distribution-nixpkgs /d' \ -e '/ jailbreak-cabal /d' \ -e '/ language-nix /d' \ -e '/ hackage-db /d' \ -e '/ cabal-install /d' \ -e '/ cabal-install-solver /d' \ -e '/ lsp /d' \ -e '/ lsp-types /d' \ -e '/ lsp-test /d' \ -e '/ hie-bios /d' \ -e '/ ShellCheck /d' \ -e '/ Agda /d' \ -e '/ stack /d' \ < "${tmpfile_new}" >> $stackage_config# Explanations:# cabal2nix, distribution-nixpkgs, jailbreak-cabal, language-nix: These are our packages and we know what we are doing.# lsp, lsp-types, lsp-test, hie-bios: These are tightly coupled to hls which is not in stackage. They have no rdeps in stackage.# ShellCheck: latest version of command-line dev tool.# Agda: The Agda community is fast-moving; we strive to always include the newest versions of Agda and the Agda packages in nixpkgs.
if [[ "${1:-}" == "--do-commit" ]]; thengit add $stackage_configgit commit -F - << EOFhaskellPackages: stackage $old_version -> $version
This commit has been generated by maintainers/scripts/haskell/update-stackage.shEOFfi