2020-05-07 02:16:38 +03:00
|
|
|
{
|
|
|
|
description = "Alternative Haskell Infrastructure for Nixpkgs";
|
|
|
|
|
2021-02-22 10:42:33 +03:00
|
|
|
inputs = {
|
2022-02-15 01:11:34 +03:00
|
|
|
nixpkgs.follows = "nixpkgs-unstable";
|
2021-08-06 06:54:39 +03:00
|
|
|
nixpkgs-2003 = { url = "github:NixOS/nixpkgs/nixpkgs-20.03-darwin"; };
|
|
|
|
nixpkgs-2105 = { url = "github:NixOS/nixpkgs/nixpkgs-21.05-darwin"; };
|
2021-12-07 02:55:20 +03:00
|
|
|
nixpkgs-2111 = { url = "github:NixOS/nixpkgs/nixpkgs-21.11-darwin"; };
|
2022-07-17 09:18:19 +03:00
|
|
|
nixpkgs-2205 = { url = "github:NixOS/nixpkgs/nixpkgs-22.05-darwin"; };
|
2021-08-06 06:54:39 +03:00
|
|
|
nixpkgs-unstable = { url = "github:NixOS/nixpkgs/nixpkgs-unstable"; };
|
|
|
|
flake-utils = { url = "github:numtide/flake-utils"; };
|
2022-03-18 16:08:11 +03:00
|
|
|
hydra.url = "hydra";
|
2021-08-06 06:54:39 +03:00
|
|
|
hackage = {
|
|
|
|
url = "github:input-output-hk/hackage.nix";
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
stackage = {
|
|
|
|
url = "github:input-output-hk/stackage.nix";
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
cabal-32 = {
|
|
|
|
url = "github:haskell/cabal/3.2";
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
cabal-34 = {
|
|
|
|
url = "github:haskell/cabal/3.4";
|
|
|
|
flake = false;
|
|
|
|
};
|
2021-12-31 04:46:22 +03:00
|
|
|
cabal-36 = {
|
|
|
|
url = "github:haskell/cabal/3.6";
|
|
|
|
flake = false;
|
|
|
|
};
|
2021-08-06 06:54:39 +03:00
|
|
|
cardano-shell = {
|
|
|
|
url = "github:input-output-hk/cardano-shell";
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
"ghc-8.6.5-iohk" = {
|
|
|
|
type = "github";
|
|
|
|
owner = "input-output-hk";
|
|
|
|
repo = "ghc";
|
|
|
|
ref = "release/8.6.5-iohk";
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
hpc-coveralls = {
|
|
|
|
url = "github:sevanspowell/hpc-coveralls";
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
nix-tools = {
|
|
|
|
url = "github:input-output-hk/nix-tools";
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
old-ghc-nix = {
|
2021-09-07 13:22:01 +03:00
|
|
|
url = "github:angerman/old-ghc-nix/master";
|
2021-08-06 06:54:39 +03:00
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
HTTP = {
|
|
|
|
url = "github:phadej/HTTP";
|
|
|
|
flake = false;
|
|
|
|
};
|
2021-02-22 10:42:33 +03:00
|
|
|
};
|
|
|
|
|
2022-07-28 11:03:05 +03:00
|
|
|
outputs = { self, nixpkgs, nixpkgs-unstable, nixpkgs-2105, nixpkgs-2111, nixpkgs-2205, flake-utils, ... }@inputs:
|
2022-06-02 11:11:27 +03:00
|
|
|
let compiler = "ghc923";
|
2021-09-15 14:00:14 +03:00
|
|
|
config = import ./config.nix;
|
2021-08-06 06:54:39 +03:00
|
|
|
in {
|
2021-09-15 14:00:14 +03:00
|
|
|
inherit config;
|
2021-08-06 06:54:39 +03:00
|
|
|
overlay = self.overlays.combined;
|
|
|
|
overlays = import ./overlays { sources = inputs; };
|
|
|
|
internal = rec {
|
|
|
|
nixpkgsArgs = {
|
|
|
|
inherit config;
|
|
|
|
overlays = [ self.overlay ];
|
|
|
|
};
|
2021-09-04 07:15:31 +03:00
|
|
|
|
2021-08-06 06:54:39 +03:00
|
|
|
sources = inputs;
|
2021-02-22 09:11:58 +03:00
|
|
|
|
2021-08-06 06:54:39 +03:00
|
|
|
overlaysOverrideable = import ./overlays;
|
|
|
|
# Compatibility with old default.nix
|
|
|
|
compat = { checkMaterialization ?
|
|
|
|
false # Allows us to easily switch on materialization checking
|
|
|
|
, system, sourcesOverride ? { }, ... }@args: rec {
|
|
|
|
sources = inputs // sourcesOverride;
|
2021-08-16 15:08:42 +03:00
|
|
|
allOverlays = import ./overlays (args // { inherit sources; });
|
|
|
|
inherit config;
|
|
|
|
# We are overriding 'overlays' and 'nixpkgsArgs' from the
|
|
|
|
# flake outputs so that we can incorporate the args passed
|
|
|
|
# to the compat layer (e.g. sourcesOverride).
|
2021-08-06 06:54:39 +03:00
|
|
|
overlays = [ allOverlays.combined ]
|
|
|
|
++ (if checkMaterialization == true then
|
|
|
|
[
|
|
|
|
(final: prev: {
|
|
|
|
haskell-nix = prev.haskell-nix // {
|
|
|
|
checkMaterialization = true;
|
|
|
|
};
|
|
|
|
})
|
|
|
|
]
|
|
|
|
else
|
|
|
|
[ ]);
|
2021-08-16 15:08:42 +03:00
|
|
|
nixpkgsArgs = {
|
|
|
|
inherit config overlays;
|
|
|
|
};
|
2021-08-06 06:54:39 +03:00
|
|
|
pkgs = import nixpkgs
|
|
|
|
(nixpkgsArgs // { localSystem = { inherit system; }; });
|
2022-07-28 11:03:05 +03:00
|
|
|
pkgs-2105 = import nixpkgs-2105
|
|
|
|
(nixpkgsArgs // { localSystem = { inherit system; }; });
|
|
|
|
pkgs-2111 = import nixpkgs-2111
|
|
|
|
(nixpkgsArgs // { localSystem = { inherit system; }; });
|
|
|
|
pkgs-2205 = import nixpkgs-2205
|
|
|
|
(nixpkgsArgs // { localSystem = { inherit system; }; });
|
2021-08-06 06:54:39 +03:00
|
|
|
pkgs-unstable = import nixpkgs-unstable
|
|
|
|
(nixpkgsArgs // { localSystem = { inherit system; }; });
|
|
|
|
hix = import ./hix/default.nix { inherit pkgs; };
|
|
|
|
};
|
2021-02-22 09:11:58 +03:00
|
|
|
};
|
|
|
|
|
2021-08-06 06:54:39 +03:00
|
|
|
# Note: `nix flake check` evaluates outputs for all platforms, and haskell.nix
|
|
|
|
# uses IFD heavily, you have to have the ability to build for all platforms
|
|
|
|
# supported by haskell.nix, e.g. with remote builders, in order to check this flake.
|
|
|
|
# If you want to run the tests for just your platform, run `./test/tests.sh` or
|
|
|
|
# `nix-build -A checks.$PLATFORM`
|
2022-06-02 11:11:27 +03:00
|
|
|
} // flake-utils.lib.eachSystem [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ] (system: rec {
|
2021-08-06 06:54:39 +03:00
|
|
|
legacyPackages = (self.internal.compat { inherit system; }).pkgs;
|
2022-01-09 01:36:53 +03:00
|
|
|
legacyPackagesUnstable = (self.internal.compat { inherit system; }).pkgs-unstable;
|
2021-02-22 09:11:58 +03:00
|
|
|
|
2021-08-06 06:54:39 +03:00
|
|
|
# FIXME: Currently `nix flake check` requires `--impure` because coverage-golden
|
|
|
|
# (and maybe other tests) import projects that use builtins.currentSystem
|
|
|
|
checks = builtins.listToAttrs (map (pkg: {
|
|
|
|
name = pkg.name;
|
|
|
|
value = pkg;
|
|
|
|
}) (nixpkgs.lib.collect nixpkgs.lib.isDerivation (import ./test rec {
|
|
|
|
haskellNix = self.internal.compat { inherit system; };
|
|
|
|
compiler-nix-name = compiler;
|
|
|
|
pkgs = haskellNix.pkgs;
|
|
|
|
})));
|
2022-06-02 11:11:27 +03:00
|
|
|
# Exposed so that buildkite can check that `allow-import-from-derivation=false` works for core of haskell.nix
|
|
|
|
roots = legacyPackagesUnstable.haskell-nix.roots compiler;
|
2021-08-06 06:54:39 +03:00
|
|
|
|
|
|
|
devShell = with self.legacyPackages.${system};
|
|
|
|
mkShell {
|
|
|
|
buildInputs = [
|
|
|
|
nixUnstable
|
|
|
|
cabal-install
|
|
|
|
haskell-nix.compiler.${compiler}
|
|
|
|
haskell-nix.nix-tools.${compiler}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
});
|
2020-05-07 02:16:38 +03:00
|
|
|
}
|