<commit_before>{ buildPackages, pkgs, newScope, stdenv }:

let
  # These are attributes in compiler and packages that don't support integer-simple.
  integerSimpleExcludes = [
    "ghc865Binary"
    "ghc8102Binary"
    "ghc8102BinaryMinimal"
    "integer-simple"
    "native-bignum"
    "ghcHEAD"
  ];

  nativeBignumIncludes = [
    "ghcHEAD"
  ];

  haskellLib = import ../development/haskell-modules/lib.nix {
    inherit (pkgs) lib;
    inherit pkgs;
  };

  callPackage = newScope {
    inherit haskellLib;
    overrides = pkgs.haskell.packageOverrides;
  };

  bootstrapPackageSet = self: super: {
    mkDerivation = drv: super.mkDerivation (drv // {
      doCheck = false;
      doHaddock = false;
      enableExecutableProfiling = false;
      enableLibraryProfiling = false;
      enableSharedExecutables = false;
      enableSharedLibraries = false;
    });
  };

  # Use this rather than `rec { ... }` below for sake of overlays.
  inherit (pkgs.haskell) compiler packages;

  # temporarily use python 3.8 since 3.9 fails with musl
  # https://github.com/NixOS/nixpkgs/issues/131557
  muslArgs = pkgs.lib.optionalAttrs pkgs.stdenv.buildPlatform.isMusl {
    python3 = buildPackages.python38;
  };

in {
  lib = haskellLib;

  package-list = callPackage ../development/haskell-modules/package-list.nix {};

  compiler = {

    ghc865Binary = callPackage ../development/compilers/ghc/8.6.5-binary.nix { };

    ghc8102Binary = callPackage ../development/compilers/ghc/8.10.2-binary.nix {
      llvmPackages = pkgs.llvmPackages_9;
    };

    ghc8102BinaryMinimal = callPackage ../development/compilers/ghc/8.10.2-binary.nix {
      llvmPackages = pkgs.llvmPackages_9;
      minimal = true;
    };

    ghc884 = callPackage ../development/compilers/ghc/8.8.4.nix ({
      # aarch64 ghc865Binary gets SEGVs due to haskell#15449 or similar
      # Musl bindists do not exist for ghc 8.6.5, so we use 8.10.* for them
      bootPkgs = if stdenv.isAarch64 || stdenv.targetPlatform.isMusl then
          packages.ghc8102BinaryMinimal
        else
          packages.ghc865Binary;
      inherit (buildPackages.python3Packages) sphinx;
      buildLlvmPackages = buildPackages.llvmPackages_7;
      llvmPackages = pkgs.llvmPackages_7;
    } // muslArgs);
    ghc8104 = callPackage ../development/compilers/ghc/8.10.4.nix ({
      # aarch64 ghc865Binary gets SEGVs due to haskell#15449 or similar
      # Musl bindists do not exist for ghc 8.6.5, so we use 8.10.* for them
      bootPkgs = if stdenv.isAarch64 || stdenv.isAarch32 || stdenv.targetPlatform.isMusl then
          packages.ghc8102BinaryMinimal
        else
          packages.ghc865Binary;
      inherit (buildPackages.python3Packages) sphinx;
      buildLlvmPackages = buildPackages.llvmPackages_9;
      llvmPackages = pkgs.llvmPackages_9;
    } // muslArgs);
    ghc901 = callPackage ../development/compilers/ghc/9.0.1.nix ({
      # aarch64 ghc8102Binary exceeds max output size on hydra
      bootPkgs = if stdenv.isAarch64 || stdenv.isAarch32 then
          packages.ghc8102BinaryMinimal
        else
          packages.ghc8102Binary;
      inherit (buildPackages.python3Packages) sphinx;
      buildLlvmPackages = buildPackages.llvmPackages_10;
      llvmPackages = pkgs.llvmPackages_10;
    } // muslArgs);
    ghcHEAD = callPackage ../development/compilers/ghc/head.nix ({
      bootPkgs = packages.ghc901; # no binary yet
      inherit (buildPackages.python3Packages) sphinx;
      buildLlvmPackages = buildPackages.llvmPackages_10;
      llvmPackages = pkgs.llvmPackages_10;
      libffi = pkgs.libffi;
    } // muslArgs);

    # The integer-simple attribute set contains all the GHC compilers
    # build with integer-simple instead of integer-gmp.
    integer-simple = let
      integerSimpleGhcNames = pkgs.lib.filter
        (name: ! builtins.elem name integerSimpleExcludes)
        (pkgs.lib.attrNames compiler);
    in pkgs.recurseIntoAttrs (pkgs.lib.genAttrs
      integerSimpleGhcNames
      (name: compiler.${name}.override { enableIntegerSimple = true; }));

    # Starting from GHC 9, integer-{simple,gmp} is replaced by ghc-bignum
    # with "native" and "gmp" backends.
    native-bignum = let
      nativeBignumGhcNames = pkgs.lib.filter
        (name: builtins.elem name nativeBignumIncludes)
        (pkgs.lib.attrNames compiler);
    in pkgs.recurseIntoAttrs (pkgs.lib.genAttrs
      nativeBignumGhcNames
      (name: compiler.${name}.override { enableNativeBignum = true; }));
  };

  # Default overrides that are applied to all package sets.
  packageOverrides = self : super : {};<commit_msg>Revert "pkgsMusl.haskell.compiler.*: use python38 to unbreak build"<commit_after>{ buildPackages, pkgs, newScope, stdenv }:

let
  # These are attributes in compiler and packages that don't support integer-simple.
  integerSimpleExcludes = [
    "ghc865Binary"
    "ghc8102Binary"
    "ghc8102BinaryMinimal"
    "integer-simple"
    "native-bignum"
    "ghcHEAD"
  ];

  nativeBignumIncludes = [
    "ghcHEAD"
  ];

  haskellLib = import ../development/haskell-modules/lib.nix {
    inherit (pkgs) lib;
    inherit pkgs;
  };

  callPackage = newScope {
    inherit haskellLib;
    overrides = pkgs.haskell.packageOverrides;
  };

  bootstrapPackageSet = self: super: {
    mkDerivation = drv: super.mkDerivation (drv // {
      doCheck = false;
      doHaddock = false;
      enableExecutableProfiling = false;
      enableLibraryProfiling = false;
      enableSharedExecutables = false;
      enableSharedLibraries = false;
    });
  };

  # Use this rather than `rec { ... }` below for sake of overlays.
  inherit (pkgs.haskell) compiler packages;

in {
  lib = haskellLib;

  package-list = callPackage ../development/haskell-modules/package-list.nix {};

  compiler = {

    ghc865Binary = callPackage ../development/compilers/ghc/8.6.5-binary.nix { };

    ghc8102Binary = callPackage ../development/compilers/ghc/8.10.2-binary.nix {
      llvmPackages = pkgs.llvmPackages_9;
    };

    ghc8102BinaryMinimal = callPackage ../development/compilers/ghc/8.10.2-binary.nix {
      llvmPackages = pkgs.llvmPackages_9;
      minimal = true;
    };

    ghc884 = callPackage ../development/compilers/ghc/8.8.4.nix {
      # aarch64 ghc865Binary gets SEGVs due to haskell#15449 or similar
      # Musl bindists do not exist for ghc 8.6.5, so we use 8.10.* for them
      bootPkgs = if stdenv.isAarch64 || stdenv.targetPlatform.isMusl then
          packages.ghc8102BinaryMinimal
        else
          packages.ghc865Binary;
      inherit (buildPackages.python3Packages) sphinx;
      buildLlvmPackages = buildPackages.llvmPackages_7;
      llvmPackages = pkgs.llvmPackages_7;
    };
    ghc8104 = callPackage ../development/compilers/ghc/8.10.4.nix {
      # aarch64 ghc865Binary gets SEGVs due to haskell#15449 or similar
      # Musl bindists do not exist for ghc 8.6.5, so we use 8.10.* for them
      bootPkgs = if stdenv.isAarch64 || stdenv.isAarch32 || stdenv.targetPlatform.isMusl then
          packages.ghc8102BinaryMinimal
        else
          packages.ghc865Binary;
      inherit (buildPackages.python3Packages) sphinx;
      buildLlvmPackages = buildPackages.llvmPackages_9;
      llvmPackages = pkgs.llvmPackages_9;
    };
    ghc901 = callPackage ../development/compilers/ghc/9.0.1.nix {
      # aarch64 ghc8102Binary exceeds max output size on hydra
      bootPkgs = if stdenv.isAarch64 || stdenv.isAarch32 then
          packages.ghc8102BinaryMinimal
        else
          packages.ghc8102Binary;
      inherit (buildPackages.python3Packages) sphinx;
      buildLlvmPackages = buildPackages.llvmPackages_10;
      llvmPackages = pkgs.llvmPackages_10;
    };
    ghcHEAD = callPackage ../development/compilers/ghc/head.nix {
      bootPkgs = packages.ghc901; # no binary yet
      inherit (buildPackages.python3Packages) sphinx;
      buildLlvmPackages = buildPackages.llvmPackages_10;
      llvmPackages = pkgs.llvmPackages_10;
      libffi = pkgs.libffi;
    };

    # The integer-simple attribute set contains all the GHC compilers
    # build with integer-simple instead of integer-gmp.
    integer-simple = let
      integerSimpleGhcNames = pkgs.lib.filter
        (name: ! builtins.elem name integerSimpleExcludes)
        (pkgs.lib.attrNames compiler);
    in pkgs.recurseIntoAttrs (pkgs.lib.genAttrs
      integerSimpleGhcNames
      (name: compiler.${name}.override { enableIntegerSimple = true; }));

    # Starting from GHC 9, integer-{simple,gmp} is replaced by ghc-bignum
    # with "native" and "gmp" backends.
    native-bignum = let
      nativeBignumGhcNames = pkgs.lib.filter
        (name: builtins.elem name nativeBignumIncludes)
        (pkgs.lib.attrNames compiler);
    in pkgs.recurseIntoAttrs (pkgs.lib.genAttrs
      nativeBignumGhcNames
      (name: compiler.${name}.override { enableNativeBignum = true; }));
  };

  # Default overrides that are applied to all package sets.
  packageOverrides = self : super : {};
{'fraction_non_alphanumeric': 0.09670206819452208, 'fraction_numerical': 0.03409726103968697, 'mean_word_length': 2.9531595227574017, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '347729', 'n_tokens_mistral': 3247, 'n_tokens_neox': 2960, 'n_words': 621}