maintainers/haskell: generate core-pkgs hackage2nix configuration
`ghc-pkg list` tells us everything hackage2nix needs to know. In the past the core-packages list and compiler setting in hackage2nix was maintained manually which inevitably leads to it being forgot once in a while – this will then mess with flag resolution when generating the package set in some cases. Luckily, we can just let a simple derivation do this for us. Resolves #202621.
This commit is contained in:
parent
16078721aa
commit
b7e41b825e
@ -11,6 +11,9 @@
|
|||||||
# Related scripts are update-hackage.sh, for updating the snapshot of the
|
# Related scripts are update-hackage.sh, for updating the snapshot of the
|
||||||
# Hackage database used by hackage2nix, and update-cabal2nix-unstable.sh,
|
# Hackage database used by hackage2nix, and update-cabal2nix-unstable.sh,
|
||||||
# for updating the version of hackage2nix used to perform this task.
|
# for updating the version of hackage2nix used to perform this task.
|
||||||
|
#
|
||||||
|
# Note that this script doesn't gcroot anything, so it may be broken by an
|
||||||
|
# unfortunately timed nix-store --gc.
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
@ -20,15 +23,21 @@ HACKAGE2NIX="${HACKAGE2NIX:-hackage2nix}"
|
|||||||
# See: https://github.com/NixOS/nixpkgs/pull/122023
|
# See: https://github.com/NixOS/nixpkgs/pull/122023
|
||||||
export LC_ALL=C.UTF-8
|
export LC_ALL=C.UTF-8
|
||||||
|
|
||||||
|
config_dir=pkgs/development/haskell-modules/configuration-hackage2nix
|
||||||
|
|
||||||
|
echo "Obtaining Hackage data"
|
||||||
extraction_derivation='with import ./. {}; runCommandLocal "unpacked-cabal-hashes" { } "tar xf ${all-cabal-hashes} --strip-components=1 --one-top-level=$out"'
|
extraction_derivation='with import ./. {}; runCommandLocal "unpacked-cabal-hashes" { } "tar xf ${all-cabal-hashes} --strip-components=1 --one-top-level=$out"'
|
||||||
unpacked_hackage="$(nix-build -E "$extraction_derivation" --no-out-link)"
|
unpacked_hackage="$(nix-build -E "$extraction_derivation" --no-out-link)"
|
||||||
config_dir=pkgs/development/haskell-modules/configuration-hackage2nix
|
|
||||||
|
echo "Generating compiler configuration"
|
||||||
|
compiler_config="$(nix-build -A haskellPackages.cabal2nix-unstable.compilerConfig --no-out-link)"
|
||||||
|
|
||||||
echo "Starting hackage2nix to regenerate pkgs/development/haskell-modules/hackage-packages.nix ..."
|
echo "Starting hackage2nix to regenerate pkgs/development/haskell-modules/hackage-packages.nix ..."
|
||||||
"$HACKAGE2NIX" \
|
"$HACKAGE2NIX" \
|
||||||
--hackage "$unpacked_hackage" \
|
--hackage "$unpacked_hackage" \
|
||||||
--preferred-versions <(for n in "$unpacked_hackage"/*/preferred-versions; do cat "$n"; echo; done) \
|
--preferred-versions <(for n in "$unpacked_hackage"/*/preferred-versions; do cat "$n"; echo; done) \
|
||||||
--nixpkgs "$PWD" \
|
--nixpkgs "$PWD" \
|
||||||
|
--config "$compiler_config" \
|
||||||
--config "$config_dir/main.yaml" \
|
--config "$config_dir/main.yaml" \
|
||||||
--config "$config_dir/stackage.yaml" \
|
--config "$config_dir/stackage.yaml" \
|
||||||
--config "$config_dir/broken.yaml" \
|
--config "$config_dir/broken.yaml" \
|
||||||
|
@ -1815,7 +1815,38 @@ self: super: {
|
|||||||
database-id-class = doJailbreak super.database-id-class;
|
database-id-class = doJailbreak super.database-id-class;
|
||||||
|
|
||||||
cabal2nix-unstable = overrideCabal {
|
cabal2nix-unstable = overrideCabal {
|
||||||
passthru.updateScript = ../../../maintainers/scripts/haskell/update-cabal2nix-unstable.sh;
|
passthru = {
|
||||||
|
updateScript = ../../../maintainers/scripts/haskell/update-cabal2nix-unstable.sh;
|
||||||
|
|
||||||
|
# This is used by regenerate-hackage-packages.nix to supply the configuration
|
||||||
|
# values we can easily generate automatically without checking them in.
|
||||||
|
compilerConfig =
|
||||||
|
pkgs.runCommand
|
||||||
|
"hackage2nix-${self.ghc.haskellCompilerName}-config.yaml"
|
||||||
|
{
|
||||||
|
nativeBuildInputs = [
|
||||||
|
self.ghc
|
||||||
|
];
|
||||||
|
}
|
||||||
|
''
|
||||||
|
cat > "$out" << EOF
|
||||||
|
# generated by haskellPackages.cabal2nix-unstable.compilerConfig
|
||||||
|
compiler: ${self.ghc.haskellCompilerName}
|
||||||
|
|
||||||
|
core-packages:
|
||||||
|
# Hack: The following package is a core package of GHCJS. If we don't declare
|
||||||
|
# it, then hackage2nix will generate a Hackage database where all dependants
|
||||||
|
# of this library are marked as "broken".
|
||||||
|
- ghcjs-base-0
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
ghc-pkg list \
|
||||||
|
| tail -n '+2' \
|
||||||
|
| sed -e 's/[()]//g' -e 's/\s\+/ - /' \
|
||||||
|
>> "$out"
|
||||||
|
'';
|
||||||
|
};
|
||||||
} super.cabal2nix-unstable;
|
} super.cabal2nix-unstable;
|
||||||
|
|
||||||
# Too strict version bounds on base
|
# Too strict version bounds on base
|
||||||
|
@ -1,48 +1,4 @@
|
|||||||
# pkgs/development/haskell-modules/configuration-hackage2nix.yaml
|
# pkgs/development/haskell-modules/configuration-hackage2nix/main.yaml
|
||||||
|
|
||||||
compiler: ghc-9.2.4
|
|
||||||
|
|
||||||
core-packages:
|
|
||||||
- Cabal-3.6.3.0
|
|
||||||
- array-0.5.4.0
|
|
||||||
- base-4.16.3.0
|
|
||||||
- binary-0.8.9.0
|
|
||||||
- bytestring-0.11.3.1
|
|
||||||
- containers-0.6.5.1
|
|
||||||
- deepseq-1.4.6.1
|
|
||||||
- directory-1.3.6.2
|
|
||||||
- exceptions-0.10.4
|
|
||||||
- filepath-1.4.2.2
|
|
||||||
- ghc-9.2.4
|
|
||||||
- ghc-bignum-1.2
|
|
||||||
- ghc-boot-9.2.4
|
|
||||||
- ghc-boot-th-9.2.4
|
|
||||||
- ghc-compact-0.1.0.0
|
|
||||||
- ghc-heap-9.2.4
|
|
||||||
- ghc-prim-0.8.0
|
|
||||||
- ghci-9.2.4
|
|
||||||
- haskeline-0.8.2
|
|
||||||
- hpc-0.6.1.0
|
|
||||||
- integer-gmp-1.1
|
|
||||||
- libiserv-9.2.4
|
|
||||||
- mtl-2.2.2
|
|
||||||
- parsec-3.1.15.0
|
|
||||||
- pretty-1.1.3.6
|
|
||||||
- process-1.6.13.2
|
|
||||||
- rts-1.0.2
|
|
||||||
- stm-2.5.0.2
|
|
||||||
- template-haskell-2.18.0.0
|
|
||||||
- terminfo-0.4.1.5
|
|
||||||
- text-1.2.5.0
|
|
||||||
- time-1.11.1.1
|
|
||||||
- transformers-0.5.6.2
|
|
||||||
- unix-2.7.2.2
|
|
||||||
- xhtml-3000.2.2.1
|
|
||||||
|
|
||||||
# Hack: The following package is a core package of GHCJS. If we don't declare
|
|
||||||
# it, then hackage2nix will generate a Hackage database where all dependants
|
|
||||||
# of this library are marked as "broken".
|
|
||||||
- ghcjs-base-0
|
|
||||||
|
|
||||||
# This is a list of packages with versions from the latest Stackage LTS release.
|
# This is a list of packages with versions from the latest Stackage LTS release.
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user