summary refs log tree commit diff
path: root/pkgs/development/compilers/nim/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/nim/default.nix')
-rw-r--r--pkgs/development/compilers/nim/default.nix70
1 files changed, 47 insertions, 23 deletions
diff --git a/pkgs/development/compilers/nim/default.nix b/pkgs/development/compilers/nim/default.nix
index aaf45ac36f6..77d8710cdf9 100644
--- a/pkgs/development/compilers/nim/default.nix
+++ b/pkgs/development/compilers/nim/default.nix
@@ -1,14 +1,15 @@
 # based on https://github.com/nim-lang/Nim/blob/v0.18.0/.travis.yml
 
-{ stdenv, lib, fetchurl, makeWrapper, nodejs-slim-10_x, openssl, pcre, readline, boehmgc, sfml, tzdata, coreutils }:
+{ stdenv, lib, fetchurl, makeWrapper, nodejs-slim-11_x, openssl, pcre, readline,
+  boehmgc, sfml, tzdata, coreutils, sqlite }:
 
 stdenv.mkDerivation rec {
   name = "nim-${version}";
-  version = "0.19.4";
+  version = "0.20.0";
 
   src = fetchurl {
     url = "https://nim-lang.org/download/${name}.tar.xz";
-    sha256 = "0k59dhfsg5wnkc3nxg5a336pjd9jnfxabns63bl9n28iwdg16hgl";
+    sha256 = "144sd7icg2p6qsrr29jdnl11hr34daxq4h16ywwrayz866w7kx2i";
   };
 
   doCheck = !stdenv.isDarwin;
@@ -20,6 +21,7 @@ stdenv.mkDerivation rec {
     "-lpcre"
     "-lreadline"
     "-lgc"
+    "-lsqlite3"
   ];
 
   # 1. nodejs is only needed for tests
@@ -27,19 +29,21 @@ stdenv.mkDerivation rec {
   #    used for bootstrapping, but koch insists on moving the nim compiler around
   #    as part of building it, so it cannot be read-only
 
+  checkInputs = [
+    nodejs-slim-11_x tzdata coreutils
+  ];
+
   nativeBuildInputs = [
-    makeWrapper nodejs-slim-10_x tzdata coreutils
+    makeWrapper
   ];
 
   buildInputs = [
-    openssl pcre readline boehmgc sfml
+    openssl pcre readline boehmgc sfml sqlite
   ];
 
-  phases = [ "unpackPhase" "patchPhase" "buildPhase" "installPhase" "checkPhase" ];
-
   buildPhase = ''
-    # use $CC to trigger the linker since calling ld in build.sh causes an error
-    LD=$CC
+    runHook preBuild
+
     # build.sh wants to write to $HOME/.cache
     HOME=$TMPDIR
     sh build.sh
@@ -48,35 +52,55 @@ stdenv.mkDerivation rec {
                  -d:useGnuReadline \
                  ${lib.optionals (stdenv.isDarwin || stdenv.isLinux) "-d:nativeStacktrace"}
     ./koch tools -d:release
-  '';
 
-  installPhase = ''
-    install -Dt $out/bin bin/* koch
-    ./koch install $out
-    mv $out/nim/bin/* $out/bin/ && rmdir $out/nim/bin
-    mv $out/nim/*     $out/     && rmdir $out/nim
-    wrapProgram $out/bin/nim \
-      --suffix PATH : ${lib.makeBinPath [ stdenv.cc ]}
+    runHook postBuild
   '';
 
-  patchPhase =
+  prePatch =
     let disableTest = ''sed -i '1i discard \"\"\"\n  disabled: true\n\"\"\"\n\n' '';
         disableStdLibTest = ''sed -i -e '/^when isMainModule/,/^END$/{s/^/#/}' '';
+        disableCompile = ''sed -i -e 's/^/#/' '';
     in ''
-      substituteInPlace ./tests/async/tioselectors.nim --replace "/bin/sleep" "sleep"
       substituteInPlace ./tests/osproc/tworkingdir.nim --replace "/usr/bin" "${coreutils}/bin"
       substituteInPlace ./tests/stdlib/ttimes.nim --replace "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo"
 
-      # disable tests requiring network access (not available in the build container)
+      # reported upstream: https://github.com/nim-lang/Nim/issues/11435
+      ${disableTest} ./tests/misc/tstrace.nim
+
+      # runs out of memory on a machine with 8GB RAM
+      ${disableTest} ./tests/system/t7894.nim
+
+      # requires network access (not available in the build container)
       ${disableTest} ./tests/stdlib/thttpclient.nim
     '' + lib.optionalString stdenv.isAarch64 ''
-      # disable test supposedly broken on aarch64
+      # supposedly broken on aarch64
       ${disableStdLibTest} ./lib/pure/stats.nim
+
+      # reported upstream: https://github.com/nim-lang/Nim/issues/11463
+      ${disableCompile} ./lib/nimhcr.nim
+      ${disableTest} ./tests/dll/nimhcr_unit.nim
+      ${disableTest} ./tests/dll/nimhcr_integration.nim
     '';
 
   checkPhase = ''
-    PATH=$PATH:$out/bin
-    ./koch tests
+    runHook preCheck
+
+    ./koch tests --nim:bin/nim all
+
+    runHook postCheck
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    install -Dt $out/bin bin/* koch
+    ./koch install $out
+    mv $out/nim/bin/* $out/bin/ && rmdir $out/nim/bin
+    mv $out/nim/*     $out/     && rmdir $out/nim
+    wrapProgram $out/bin/nim \
+      --suffix PATH : ${lib.makeBinPath [ stdenv.cc ]}
+
+    runHook postInstall
   '';
 
   meta = with stdenv.lib; {