2020-05-04 00:01:57 +01:00
|
|
|
#! /usr/bin/env nix-shell
|
2021-05-04 12:38:29 +01:00
|
|
|
#! nix-shell -i bash -p coreutils haskellPackages.cabal2nix-unstable -I nixpkgs=.
|
2020-05-04 00:01:57 +01:00
|
|
|
|
|
|
|
# This script is used to regenerate nixpkgs' Haskell package set, using a tool
|
|
|
|
# called hackage2nix. hackage2nix looks at
|
|
|
|
# pkgs/development/haskell-modules/configuration-hackage2nix.yaml and generates
|
|
|
|
# a Nix expression for package version specified there, using the Cabal files
|
|
|
|
# from the Hackage database (available under all-cabal-hashes) and its
|
|
|
|
# companion tool cabal2nix.
|
|
|
|
#
|
|
|
|
# Related scripts are update-hackage.sh, for updating the snapshot of the
|
2021-05-04 12:38:29 +01:00
|
|
|
# Hackage database used by hackage2nix, and update-cabal2nix-unstable.sh,
|
2020-05-04 00:01:57 +01:00
|
|
|
# for updating the version of hackage2nix used to perform this task.
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
extractionDerivation='with import ./. {}; runCommand "unpacked-cabal-hashes" { } "tar xf ${all-cabal-hashes} --strip-components=1 --one-top-level=$out"'
|
|
|
|
unpacked_hackage="$(nix-build -E "$extractionDerivation" --no-out-link)"
|
|
|
|
|
|
|
|
hackage2nix --hackage "$unpacked_hackage" --preferred-versions <(for n in "$unpacked_hackage"/*/preferred-versions; do cat "$n"; echo; done) --nixpkgs "$PWD" --config pkgs/development/haskell-modules/configuration-hackage2nix.yaml
|
2021-05-03 21:52:32 +01:00
|
|
|
|
|
|
|
if [[ "${1:-}" == "--do-commit" ]]; then
|
|
|
|
git add pkgs/development/haskell-modules/hackage-packages.nix
|
|
|
|
git commit -m "hackage-packages.nix: Regenerate based on current config"
|
|
|
|
fi
|