on iko/ghcjs-patch-master help sign in
Check ghc used is haskell-nix.compiler one (#312)
7d96b15Hamish Mackenzie
builder/hspkg-builder.nix+4
@@ -18,6 +18,10 @@
18, ...
18, ...
19}@config:
19}@config:
20
20
21+assert (if ghc.isHaskellNixCompiler or false then true
22+ else throw ("It is likely you used `haskell.compiler.X` instead of `haskell-nix.compiler.X`"
23+ + pkgs.lib.optionalString (name != null) (" for " + name)));
24+
21let
25let
22 cabalFile = if revision == null || revision == 0 then null else
26 cabalFile = if revision == null || revision == 0 then null else
23 fetchurl {
27 fetchurl {
compiler/ghc/default.nix+3
@@ -310,6 +310,9 @@ in stdenv.mkDerivation (rec {
310 haskellCompilerName = "ghc-${version}";
310 haskellCompilerName = "ghc-${version}";
311
311
312 configured-src = configured-src;
312 configured-src = configured-src;
313+
314+ # Used to detect non haskell-nix compilers (accedental use of nixpkgs compilers can lead to unexpected errors)
315+ isHaskellNixCompiler = true;
313 } // extra-passthru;
316 } // extra-passthru;
314
317
315 meta = {
318 meta = {
lib/call-cabal-project-to-nix.nix+5
@@ -16,6 +16,11 @@
16assert (if (builtins.compareVersions cabal-install.version "2.4.0.0") < 0
16assert (if (builtins.compareVersions cabal-install.version "2.4.0.0") < 0
17 then throw "cabal-install (current version: ${cabal-install.version}) needs to be at least 2.4 for plan-to-nix to work without cabal-to-nix"
17 then throw "cabal-install (current version: ${cabal-install.version}) needs to be at least 2.4 for plan-to-nix to work without cabal-to-nix"
18 else true);
18 else true);
19+
20+assert (if ghc.isHaskellNixCompiler or false then true
21+ else throw ("It is likely you used `haskell.compiler.X` instead of `haskell-nix.compiler.X`"
22+ + pkgs.lib.optionalString (name != null) (" for " + name)));
23+
19let
24let
20 maybeCleanedSource =
25 maybeCleanedSource =
21 if haskellLib.canCleanSource src
26 if haskellLib.canCleanSource src
overlays/bootstrap.nix+12−5
@@ -229,7 +229,10 @@ self: super: {
229 # this is not ideal!
229 # this is not ideal!
230 # get binary compilers for bootstrapping. We'll put the eventual proper
230 # get binary compilers for bootstrapping. We'll put the eventual proper
231 # compilers into the same place where nix expects them.
231 # compilers into the same place where nix expects them.
232+ # We mark these compilers as boot compilers to make sure they are only used
233+ # where a boot compiler is expected.
234+ compiler = builtins.mapAttrs (_: v: v // { isHaskellNixBootCompiler = true; })
232− compiler = import ../compiler/old-ghc-nix { pkgs = self; };
235+ (import ../compiler/old-ghc-nix { pkgs = self; });
233
236
234 packages = {
237 packages = {
235 # cabal has it's own bootstrap script which we'll use.
238 # cabal has it's own bootstrap script which we'll use.
@@ -246,7 +249,8 @@ self: super: {
246 # disable hpack support during bootstrap
249 # disable hpack support during bootstrap
247 hpack = null;
250 hpack = null;
248 nix-tools = nix-tools.override {
251 nix-tools = nix-tools.override {
249− inherit ghc;
252+ # Only a boot compiler is suitable here
253+ ghc = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; };
250 inherit (bootstrap.packages) hpack;
254 inherit (bootstrap.packages) hpack;
251 };
255 };
252
256
@@ -256,7 +260,8 @@ self: super: {
256 # need to use the boot strap compiler as we need them
260 # need to use the boot strap compiler as we need them
257 # to build ghcs from source.
261 # to build ghcs from source.
258 alex-project = hackage-project {
262 alex-project = hackage-project {
259− inherit ghc;
263+ # Only a boot compiler is suitable here
264+ ghc = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; };
260 inherit (bootstrap.packages) cabal-install nix-tools hpack;
265 inherit (bootstrap.packages) cabal-install nix-tools hpack;
261 name = "alex"; version = "3.2.4";
266 name = "alex"; version = "3.2.4";
262 index-state = "2019-10-20T00:00:00Z";
267 index-state = "2019-10-20T00:00:00Z";
@@ -264,7 +269,8 @@ self: super: {
264 };
269 };
265 alex = bootstrap.packages.alex-project.alex.components.exes.alex;
270 alex = bootstrap.packages.alex-project.alex.components.exes.alex;
266 happy-project = hackage-project {
271 happy-project = hackage-project {
267− inherit ghc;
272+ # Only a boot compiler is suitable here
273+ ghc = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; };
268 inherit (bootstrap.packages) cabal-install nix-tools hpack;
274 inherit (bootstrap.packages) cabal-install nix-tools hpack;
269 name = "happy"; version = "1.19.11";
275 name = "happy"; version = "1.19.11";
270 index-state = "2019-10-20T00:00:00Z";
276 index-state = "2019-10-20T00:00:00Z";
@@ -272,7 +278,8 @@ self: super: {
272 };
278 };
273 happy = bootstrap.packages.happy-project.happy.components.exes.happy;
279 happy = bootstrap.packages.happy-project.happy.components.exes.happy;
274 hscolour-project = hackage-project {
280 hscolour-project = hackage-project {
275− inherit ghc;
281+ # Only a boot compiler is suitable here
282+ ghc = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; };
276 inherit (bootstrap.packages) cabal-install nix-tools hpack;
283 inherit (bootstrap.packages) cabal-install nix-tools hpack;
277 name = "hscolour"; version = "1.24.4";
284 name = "hscolour"; version = "1.24.4";
278 index-state = "2019-10-20T00:00:00Z";
285 index-state = "2019-10-20T00:00:00Z";