hnix-store/matrix.nix
Richard Marko 994a3ae01f add matrix.nix for matrix build using all packages and compilers
Uses ci.dhall as a single source of truth
(ci.dhall.frozen which is now-autoupdated via ci.sh)
2023-11-19 11:55:18 +01:00

34 lines
1.0 KiB
Nix

# Matrix build for all packages and compilers
#
# Uses ./.github/workflows/ci.dhall as a single source of
# truth for a list of supported compilers
#
# The dhall expression needs to be frozen via dhall freeze
# which is done automatically when we update it via ./.github/workflows/ci.sh
# and dhallDirectoryToNix uses ci.dhall.frozen instead
{ pkgs ? import <nixpkgs> {}
}:
let
lib = pkgs.lib;
ciDhallNix = pkgs.dhallDirectoryToNix { src = ./.github/workflows; file = "ci.dhall.frozen"; };
ciCompilers = ciDhallNix.jobs.build.strategy.matrix.ghc;
# from e.g. 9.6.3 to ghc963
convertCompilers = cs:
map (x: "ghc${lib.strings.replaceStrings ["."] [""] x}") cs;
compilers =
lib.traceValFn (cs:
let
prettyCs = lib.concatMapStringsSep "\n" (c: "- ${c}") cs;
in
"building for compilers:\n${prettyCs}")
(convertCompilers ciCompilers);
in
pkgs.lib.recurseIntoAttrs
(pkgs.lib.genAttrs compilers (compiler:
pkgs.lib.recurseIntoAttrs
(import ./. { inherit pkgs compiler; })
)
)