mirror of
https://github.com/ilyakooo0/haskell.nix.git
synced 2024-09-11 06:55:40 +03:00
Put v1 compatibility back and fix warning (#714)
* Revert "Remove backwards compatibility with V1 code (#710)" * Fix issue with warning not being displayed
This commit is contained in:
parent
6c41c299c5
commit
22aa3506c0
85
default.nix
85
default.nix
@ -1,33 +1,56 @@
|
||||
{ checkMaterialization ? false # Allows us to easily switch on materialization checking
|
||||
, defaultCompilerNixName ? null # Quick way to override the default compiler e.g. "ghc883"
|
||||
, system ? builtins.currentSystem
|
||||
, sourcesOverride ? {}
|
||||
, ... }@args: rec {
|
||||
sources = (import ./nix/sources.nix) // sourcesOverride;
|
||||
let haskellNix = {
|
||||
checkMaterialization ? false, # Allows us to easily switch on materialization checking
|
||||
defaultCompilerNixName ? null, # Quick way to override the default compiler e.g. "ghc883"
|
||||
system ? builtins.currentSystem,
|
||||
sourcesOverride ? {},
|
||||
... }@args: rec {
|
||||
sources = (import ./nix/sources.nix) // sourcesOverride;
|
||||
|
||||
config = import ./config.nix;
|
||||
overlays = [ allOverlays.combined ] ++ (
|
||||
if checkMaterialization == true
|
||||
then [(
|
||||
final: prev: {
|
||||
haskell-nix = prev.haskell-nix // {
|
||||
checkMaterialization = true;
|
||||
};
|
||||
}
|
||||
)]
|
||||
else []
|
||||
) ++ (
|
||||
if defaultCompilerNixName != null
|
||||
then [(
|
||||
final: prev: {
|
||||
haskell-nix = prev.haskell-nix // {
|
||||
inherit defaultCompilerNixName;
|
||||
};
|
||||
}
|
||||
)]
|
||||
else []
|
||||
);
|
||||
allOverlays = import ./overlays args;
|
||||
nixpkgsArgs = { inherit config overlays system; };
|
||||
pkgs = import sources.nixpkgs-default nixpkgsArgs;
|
||||
config = import ./config.nix;
|
||||
overlays = [ allOverlays.combined ] ++ (
|
||||
if checkMaterialization == true
|
||||
then [(
|
||||
final: prev: {
|
||||
haskell-nix = prev.haskell-nix // {
|
||||
checkMaterialization = true;
|
||||
};
|
||||
}
|
||||
)]
|
||||
else []
|
||||
) ++ (
|
||||
if defaultCompilerNixName != null
|
||||
then [(
|
||||
final: prev: {
|
||||
haskell-nix = prev.haskell-nix // {
|
||||
inherit defaultCompilerNixName;
|
||||
};
|
||||
}
|
||||
)]
|
||||
else []
|
||||
);
|
||||
allOverlays = import ./overlays args;
|
||||
nixpkgsArgs = { inherit config overlays system; };
|
||||
pkgs = import sources.nixpkgs-default nixpkgsArgs;
|
||||
};
|
||||
|
||||
v1DeprecationMessage = "Version 1 is deprecated: use version 2 (nixpkgs arguments are available as the `nixpkgsArgs` attribute of version 2)";
|
||||
haskellNixV1 = (haskellNix {}).nixpkgsArgs // {
|
||||
overlays = builtins.trace v1DeprecationMessage (haskellNix {}).nixpkgsArgs.overlays;
|
||||
};
|
||||
haskellNixV2 = haskellNix;
|
||||
|
||||
# If no arguments, then you get V1
|
||||
in haskellNixV1 // {
|
||||
__functor = _: {
|
||||
version ? 2,
|
||||
checkMaterialization ? false, # Allows us to easily switch on materialization checking
|
||||
defaultCompilerNixName ? null, # Quick way to override the default compiler e.g. "ghc883"
|
||||
system ? builtins.currentSystem,
|
||||
sourcesOverride ? {},
|
||||
... }@args:
|
||||
if version == 1
|
||||
then haskellNixV1
|
||||
else if version == 2
|
||||
then haskellNixV2 args
|
||||
else builtins.throw ("haskell.nix: unknown version: " + (builtins.toString version));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user