mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-18 03:30:45 +00:00
maintainers/haskell/test-configurations.nix: support ghcHEAD
Since we now have a versioned configuration-ghc-*.nix file for GHC HEAD, we don't need to add a super special case to the package set logic in test-configurations.nix anymore. We can just create a versioned attribute for the ghcHEAD package set (which is not exposed) and keep using the normal discovery logic. The only tricky bit is that GHC HEAD's configuration file is named after the GHC release that will be branched off from it, so a little bit of arithmetic is involved.
This commit is contained in:
parent
994a371e43
commit
3dfbe2b6a3
|
@ -66,6 +66,28 @@ let
|
|||
if !builtins.isList files then [ files ] else files
|
||||
);
|
||||
|
||||
packageSetsWithVersionedHead = pkgs.haskell.packages // (
|
||||
let
|
||||
headSet = pkgs.haskell.packages.ghcHEAD;
|
||||
# Determine the next GHC release version following GHC HEAD.
|
||||
# GHC HEAD always has an uneven, tentative version number, e.g. 9.7.
|
||||
# GHC releases always have even numbers, i.e. GHC 9.8 is branched off from
|
||||
# GHC HEAD 9.7. Since we use the to be release number for GHC HEAD's
|
||||
# configuration file, we need to calculate this here.
|
||||
headVersion = lib.pipe headSet.ghc.version [
|
||||
lib.versions.splitVersion
|
||||
(lib.take 2)
|
||||
lib.concatStrings
|
||||
lib.strings.toInt
|
||||
(builtins.add 1)
|
||||
toString
|
||||
];
|
||||
in
|
||||
{
|
||||
"ghc${headVersion}" = headSet;
|
||||
}
|
||||
);
|
||||
|
||||
setsForFile = fileName:
|
||||
let
|
||||
# extract the unique part of the config's file name
|
||||
|
@ -77,12 +99,12 @@ let
|
|||
builtins.match "ghc-([0-9]+).([0-9]+).x" configName
|
||||
);
|
||||
# return all package sets under haskell.packages matching the version components
|
||||
setsForVersion = builtins.map (name: pkgs.haskell.packages.${name}) (
|
||||
setsForVersion = builtins.map (name: packageSetsWithVersionedHead.${name}) (
|
||||
builtins.filter (setName:
|
||||
lib.hasPrefix "ghc${configVersion}" setName
|
||||
&& (skipBinaryGHCs -> !(lib.hasInfix "Binary" setName))
|
||||
) (
|
||||
builtins.attrNames pkgs.haskell.packages
|
||||
builtins.attrNames packageSetsWithVersionedHead
|
||||
)
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue