on iko/ghcjs-patch-master help sign in
Better error message when building missing ghcjs (#1140)
90184a7Hamish Mackenzie
overlays/bootstrap.nix+16−34
@@ -48,6 +48,7 @@ let
48 };
48 };
49 traceWarnOld = v: x: __trace
49 traceWarnOld = v: x: __trace
50 "WARNING: ${x.src-spec.version} is out of date, consider using ${latestVer.${v}}." x;
50 "WARNING: ${x.src-spec.version} is out of date, consider using ${latestVer.${v}}." x;
51+ errorOldGhcjs = v: up: throw "ghcjs ${v} is no longer supported by haskell.nix. Consider using ${latestVer.${up}}";
51in {
52in {
52 haskell-nix = prev.haskell-nix // {
53 haskell-nix = prev.haskell-nix // {
53 # Use this to disable the existing haskell infra structure for testing purposes
54 # Use this to disable the existing haskell infra structure for testing purposes
@@ -515,6 +516,21 @@ in {
515 isHaskellNixBootCompiler = true;
516 isHaskellNixBootCompiler = true;
516 })
517 })
517 ({
518 ({
519+ # Better error messages when an unsupported version of ghcjs is used
520+ ghc844 = errorOldGhcjs "8.4.4" "8.6";
521+ ghc861 = errorOldGhcjs "8.6.1" "8.6";
522+ ghc862 = errorOldGhcjs "8.6.2" "8.6";
523+ ghc863 = errorOldGhcjs "8.6.3" "8.6";
524+ ghc864 = errorOldGhcjs "8.6.4" "8.6";
525+ ghc881 = errorOldGhcjs "8.8.1" "8.8";
526+ ghc882 = errorOldGhcjs "8.8.2" "8.8";
527+ ghc883 = errorOldGhcjs "8.8.3" "8.8";
528+ ghc8101 = errorOldGhcjs "8.10.1" "8.10";
529+ ghc8102 = errorOldGhcjs "8.10.2" "8.10";
530+ ghc8103 = errorOldGhcjs "8.10.3" "8.10";
531+ ghc8104 = errorOldGhcjs "8.10.4" "8.10";
532+ ghc810420210212 = throw "ghcjs for ghc810420210212 is not supported by haskell.nix";
533+ ghc901 = throw "ghcjs 9.0.1 is not yet supported by haskell.nix";
518 ghc865 = let buildGHC = final.buildPackages.haskell-nix.compiler.ghc865;
534 ghc865 = let buildGHC = final.buildPackages.haskell-nix.compiler.ghc865;
519 in let booted-ghcjs = final.callPackage ../compiler/ghcjs/ghcjs.nix {
535 in let booted-ghcjs = final.callPackage ../compiler/ghcjs/ghcjs.nix {
520 ghcjsSrcJson = ../compiler/ghcjs/ghcjs-src.json;
536 ghcjsSrcJson = ../compiler/ghcjs/ghcjs-src.json;
@@ -547,40 +563,6 @@ in {
547 cd lib
563 cd lib
548 lndir ${booted-ghcjs}/lib ${targetPrefix}ghc-8.6.5
564 lndir ${booted-ghcjs}/lib ${targetPrefix}ghc-8.6.5
549 '' + installDeps targetPrefix);
565 '' + installDeps targetPrefix);
550− ghc883 = let buildGHC = final.buildPackages.haskell-nix.compiler.ghc883;
551− in let booted-ghcjs = final.callPackage ../compiler/ghcjs/ghcjs.nix {
552− ghcjsSrcJson = ../compiler/ghcjs/ghcjs88-src.json;
553− ghcjsVersion = "8.8.0.0.1";
554− ghc = buildGHC;
555− ghcVersion = "8.8.3";
556− compiler-nix-name = "ghc883";
557− }; in let targetPrefix = "js-unknown-ghcjs-"; in final.runCommand "${targetPrefix}ghc-8.8.3" {
558− nativeBuildInputs = [ final.xorg.lndir ];
559− passthru = {
560− inherit targetPrefix;
561− version = "8.8.3";
562− isHaskellNixCompiler = true;
563− enableShared = false;
564− inherit (booted-ghcjs) configured-src bundled-ghcjs project;
565− inherit booted-ghcjs buildGHC;
566− extraConfigureFlags = [
567− "--ghcjs"
568− "--with-ghcjs=${targetPrefix}ghc" "--with-ghcjs-pkg=${targetPrefix}ghc-pkg"
569− "--with-gcc=${final.buildPackages.emscripten}/bin/emcc"
570− ];
571− };
572− # note: we'll use the buildGHCs `hsc2hs`, ghcjss wrapper just horribly breaks in this nix setup.
573− } (''
574− mkdir -p $out/bin
575− cd $out/bin
576− ln -s ${booted-ghcjs}/bin/ghcjs ${targetPrefix}ghc
577− ln -s ${booted-ghcjs}/bin/ghcjs-pkg ${targetPrefix}ghc-pkg
578− ln -s ${buildGHC}/bin/hsc2hs ${targetPrefix}hsc2hs
579− cd ..
580− mkdir -p lib/${targetPrefix}ghc-8.8.3
581− cd lib
582− lndir ${booted-ghcjs}/lib ${targetPrefix}ghc-8.8.3
583− '' + installDeps targetPrefix);
584 ghc884 = let buildGHC = final.buildPackages.haskell-nix.compiler.ghc884;
566 ghc884 = let buildGHC = final.buildPackages.haskell-nix.compiler.ghc884;
585 in let booted-ghcjs = final.callPackage ../compiler/ghcjs/ghcjs.nix {
567 in let booted-ghcjs = final.callPackage ../compiler/ghcjs/ghcjs.nix {
586 ghcjsSrcJson = ../compiler/ghcjs/ghcjs88-src.json;
568 ghcjsSrcJson = ../compiler/ghcjs/ghcjs88-src.json;
test/haskell-language-server/stack.nix+5−8
@@ -1,21 +1,18 @@
1−{ lib, testSrc, haskell-nix, evalPackages, buildPackages, compiler-nix-name, recurseIntoAttrs }:
1+{ stdenv, lib, testSrc, haskell-nix, evalPackages, buildPackages, compiler-nix-name, recurseIntoAttrs }:
2let
2let
3 project = buildPackages.haskell-nix.project' {
3 project = buildPackages.haskell-nix.project' {
4 inherit compiler-nix-name;
4 inherit compiler-nix-name;
5 src = evalPackages.fetchgit {
5 src = evalPackages.fetchgit {
6 url = "https://github.com/haskell/haskell-language-server.git";
6 url = "https://github.com/haskell/haskell-language-server.git";
7 fetchSubmodules = true;
7 fetchSubmodules = true;
8− rev = "1.1.0";
8+ rev = "1.2.0";
9− sha256 = "sha256-5bIr7Zsvn1B8bjjiHPLQQS8+qW3ZiEwqBnFUG+fAcU8=";
9+ sha256 = "sha256-vNpb/Fjb9sKkt/1r29c82P/NeAXpxQbVKnM/EDWY6z4=";
10 };
10 };
11− projectFileName = "stack-${buildPackages.haskell-nix.compiler.${
11+ projectFileName = "stack-${buildPackages.haskell-nix.compiler.${compiler-nix-name}.version}.yaml";
12− if compiler-nix-name == "ghc8105"
13− then "ghc8104"
14− else compiler-nix-name
15− }.version}.yaml";
16 sha256map = {
12 sha256map = {
17 "https://github.com/alanz/ghc-exactprint.git"."6748e24da18a6cea985d20cc3e1e7920cb743795" = "18r41290xnlizgdwkvz16s7v8k2znc7h215sb1snw6ga8lbv60rb";
13 "https://github.com/alanz/ghc-exactprint.git"."6748e24da18a6cea985d20cc3e1e7920cb743795" = "18r41290xnlizgdwkvz16s7v8k2znc7h215sb1snw6ga8lbv60rb";
18 "https://github.com/bubba/brittany.git"."c59655f10d5ad295c2481537fc8abf0a297d9d1c" = "1rkk09f8750qykrmkqfqbh44dbx1p8aq1caznxxlw8zqfvx39cxl";
14 "https://github.com/bubba/brittany.git"."c59655f10d5ad295c2481537fc8abf0a297d9d1c" = "1rkk09f8750qykrmkqfqbh44dbx1p8aq1caznxxlw8zqfvx39cxl";
15+ "https://github.com/hsyl20/ghc-api-compat.git"."8fee87eac97a538dbe81ff1ab18cff10f2f9fa15" = "sha256-byehvdxQxhNk5ZQUXeFHjAZpAze4Ct9261ro4c5acZk=";
19 };
16 };
20 };
17 };
21in recurseIntoAttrs {
18in recurseIntoAttrs {