1#! /usr/bin/env nix-shell
2#! nix-shell -i bash -p coreutils jq -I nixpkgs=.
3
4set -euo pipefail
5
6TMP_TEMPLATE=transitive-broken.XXXXXXX
7readonly TMP_TEMPLATE
8
9tmpfile=$(mktemp "$TMP_TEMPLATE")
10
11trap 'rm -f "${tmpfile}"' 0
12
13config_file=pkgs/development/haskell-modules/configuration-hackage2nix/transitive-broken.yaml
14
15cat > $tmpfile << EOF
16# This file is automatically generated by
17# maintainers/scripts/haskell/regenerate-transitive-broken-packages.sh
18# It is supposed to list all haskellPackages that cannot evaluate because they
19# depend on a dependency marked as broken.
20dont-distribute-packages:
21EOF
22
23nix-instantiate --eval --option restrict-eval true -I . --strict --json maintainers/scripts/haskell/transitive-broken-packages.nix | jq -r . | LC_ALL=C.UTF-8 sort --ignore-case >> $tmpfile
24
25mv $tmpfile $config_file