@@ -1,14 +1,14 @@
11# based on https://github.com/nim-lang/Nim/blob/v0.18.0/.travis.yml
22
3−{ stdenv, lib, fetchurl, makeWrapper, nodejs-slim-8_x, openssl, pcre, readline, sqlite, boehmgc, sfml, tzdata, coreutils }:
3+{ stdenv, lib, fetchurl, makeWrapper, nodejs-slim-10_x, openssl, pcre, readline, boehmgc, sfml, tzdata, coreutils }:
44
55stdenv.mkDerivation rec {
66 name = "nim-${version}";
7− version = "0.18.0";
7+ version = "0.19.0";
88
99 src = fetchurl {
1010 url = "https://nim-lang.org/download/${name}.tar.xz";
11− sha256 = "45c74adb35f08dfa9add1112ae17330e5d902ebb4a36e7046caee8b79e6f3bd0";
11+ sha256 = "0biwvw1gividp5lkf0daq1wp9v6ms4xy6dkf5zj0sn9w4m3n76d1";
1212 };
1313
1414 doCheck = !stdenv.isDarwin;
@@ -19,7 +19,6 @@ stdenv.mkDerivation rec {
1919 "-lcrypto"
2020 "-lpcre"
2121 "-lreadline"
22− "-lsqlite3"
2322 "-lgc"
2423 ];
2524
@@ -28,12 +27,21 @@ stdenv.mkDerivation rec {
2827 # used for bootstrapping, but koch insists on moving the nim compiler around
2928 # as part of building it, so it cannot be read-only
3029
30+ nativeBuildInputs = [
31+ makeWrapper nodejs-slim-10_x tzdata coreutils
32+ ];
33+
3134 buildInputs = [
32− makeWrapper nodejs-slim-8_x tzdata coreutils
33− openssl pcre readline sqlite boehmgc sfml
35+ openssl pcre readline boehmgc sfml
3436 ];
3537
38+ phases = [ "unpackPhase" "patchPhase" "buildPhase" "installPhase" "checkPhase" ];
39+
3640 buildPhase = ''
41+ # use $CC to trigger the linker since calling ld in build.sh causes an error
42+ LD=$CC
43+ # build.sh wants to write to $HOME/.cache
44+ HOME=$TMPDIR
3745 sh build.sh
3846 ./bin/nim c koch
3947 ./koch boot -d:release \
@@ -51,33 +59,24 @@ stdenv.mkDerivation rec {
5159 --suffix PATH : ${lib.makeBinPath [ stdenv.cc ]}
5260 '';
5361
54− postPatch =
62+ patchPhase =
5563 let disableTest = ''sed -i '1i discard \"\"\"\n disabled: true\n\"\"\"\n\n' '';
64+ disableStdLibTest = ''sed -i -e '/^when isMainModule/,/^END$/{s/^/#/}' '';
5665 disableCompile = ''sed -i -e 's/^/#/' '';
5766 in ''
5867 substituteInPlace ./tests/async/tioselectors.nim --replace "/bin/sleep" "sleep"
5968 substituteInPlace ./tests/osproc/tworkingdir.nim --replace "/usr/bin" "${coreutils}/bin"
6069 substituteInPlace ./tests/stdlib/ttimes.nim --replace "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo"
6170
62− # disable supposedly broken tests
63− ${disableTest} ./tests/errmsgs/tproper_stacktrace2.nim
64− ${disableTest} ./tests/vm/trgba.nim
65−
6671 # disable tests requiring network access (not available in the build container)
6772 ${disableTest} ./tests/stdlib/thttpclient.nim
68− ${disableTest} ./tests/cpp/tasync_cpp.nim
69− ${disableTest} ./tests/niminaction/Chapter7/Tweeter/src/tweeter.nim
70−
71− # disable tests requiring un-downloadable dependencies (using nimble, which isn't available in the fetch phase)
72− ${disableCompile} ./tests/manyloc/keineschweine/keineschweine.nim
73− ${disableTest} ./tests/manyloc/keineschweine/keineschweine.nim
74− ${disableCompile} ./tests/manyloc/nake/nakefile.nim
75− ${disableTest} ./tests/manyloc/nake/nakefile.nim
76− ${disableCompile} ./tests/manyloc/named_argument_bug/main.nim
77− ${disableTest} ./tests/manyloc/named_argument_bug/main.nim
73+ '' + lib.optionalString stdenv.isAarch64 ''
74+ # disable test supposedly broken on aarch64
75+ ${disableStdLibTest} ./lib/pure/stats.nim
7876 '';
7977
8078 checkPhase = ''
79+ PATH=$PATH:$out/bin
8180 ./koch tests
8281 '';
8382