on iko/ghcjs-patch-master help sign in
Remove backwards compatibility with V1 code (#710)
da44734Hamish Mackenzie
@@ -1,49 +1,33 @@
1−let haskellNix = {
2− checkMaterialization ? false, # Allows us to easily switch on materialization checking
1+{ checkMaterialization ? false # Allows us to easily switch on materialization checking
3− defaultCompilerNixName ? null, # Quick way to override the default compiler e.g. "ghc883"
2+, defaultCompilerNixName ? null # Quick way to override the default compiler e.g. "ghc883"
4− system ? builtins.currentSystem,
3+, system ? builtins.currentSystem
5− sourcesOverride ? {},
4+, sourcesOverride ? {}
6− ... }@args: rec {
5+, ... }@args: rec {
7− sources = (import ./nix/sources.nix) // sourcesOverride;
6+ sources = (import ./nix/sources.nix) // sourcesOverride;
8
7
9− config = import ./config.nix;
8+ config = import ./config.nix;
10− overlays = [ allOverlays.combined ] ++ (
9+ overlays = [ allOverlays.combined ] ++ (
11− if checkMaterialization == true
10+ if checkMaterialization == true
12− then [(
11+ then [(
13− final: prev: {
12+ final: prev: {
14− haskell-nix = prev.haskell-nix // {
13+ haskell-nix = prev.haskell-nix // {
15− checkMaterialization = true;
14+ checkMaterialization = true;
16− };
15+ };
17− }
16+ }
18− )]
17+ )]
19− else []
18+ else []
20− ) ++ (
19+ ) ++ (
21− if defaultCompilerNixName != null
20+ if defaultCompilerNixName != null
22− then [(
21+ then [(
23− final: prev: {
22+ final: prev: {
24− haskell-nix = prev.haskell-nix // {
23+ haskell-nix = prev.haskell-nix // {
25− inherit defaultCompilerNixName;
24+ inherit defaultCompilerNixName;
26− };
25+ };
27− }
26+ }
28− )]
27+ )]
29− else []
28+ else []
30− );
29+ );
31− allOverlays = import ./overlays args;
30+ allOverlays = import ./overlays args;
32− nixpkgsArgs = { inherit config overlays system; };
31+ nixpkgsArgs = { inherit config overlays system; };
33− pkgs = import sources.nixpkgs-default nixpkgsArgs;
32+ pkgs = import sources.nixpkgs-default nixpkgsArgs;
34− };
35−
36− haskellNixV1 = (haskellNix {}).nixpkgsArgs;
37− haskellNixV2 = haskellNix;
38−
39− v1DeprecationMessage = "Version 1 is deprecated: use version 2 (nixpkgs arguments are available as the `nixpkgsArgs` attribute of version 2)";
40−# If no arguments, then you get V1
41−# I'd like to make importing directly issue a warning, but I couldn't figure out a way to make it happen
42−in haskellNixV1 // {
43− __functor = _: { version ? 2, ... }@args:
44− if version == 1
45− then builtins.trace v1DeprecationMessage haskellNixV1
46− else if version == 2
47− then haskellNixV2 args
48− else builtins.throw ("haskell.nix: unknown version: " + (builtins.toString version));
49}
33}