From 9bf79add1380b436d8cf7bb885095cd1a7bcfca0 Mon Sep 17 00:00:00 2001 From: royneary Date: Sat, 27 Oct 2018 14:30:21 +0200 Subject: [PATCH 1/7] nim: 0.18.0 -> 0.19.0 - remove sqlite as dependency (I don't see why it's needed) - run checkPhase after installPhase (at least one test assumes the standard library in ../lib relative to the nim binary) - the broken tests pass now or don't exist anymore - two of the tests requiring network access pass now without network access - the tests in manyloc do not download dependencies and are passing now --- pkgs/development/compilers/nim/default.nix | 32 ++++++++-------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/pkgs/development/compilers/nim/default.nix b/pkgs/development/compilers/nim/default.nix index a4b706d35aa..0d06f847ddf 100644 --- a/pkgs/development/compilers/nim/default.nix +++ b/pkgs/development/compilers/nim/default.nix @@ -1,14 +1,14 @@ # based on https://github.com/nim-lang/Nim/blob/v0.18.0/.travis.yml -{ stdenv, lib, fetchurl, makeWrapper, nodejs-slim-8_x, openssl, pcre, readline, sqlite, boehmgc, sfml, tzdata, coreutils }: +{ stdenv, lib, fetchurl, makeWrapper, nodejs-slim-8_x, openssl, pcre, readline, boehmgc, sfml, tzdata, coreutils }: stdenv.mkDerivation rec { name = "nim-${version}"; - version = "0.18.0"; + version = "0.19.0"; src = fetchurl { url = "https://nim-lang.org/download/${name}.tar.xz"; - sha256 = "45c74adb35f08dfa9add1112ae17330e5d902ebb4a36e7046caee8b79e6f3bd0"; + sha256 = "0biwvw1gividp5lkf0daq1wp9v6ms4xy6dkf5zj0sn9w4m3n76d1"; }; doCheck = !stdenv.isDarwin; @@ -19,7 +19,6 @@ stdenv.mkDerivation rec { "-lcrypto" "-lpcre" "-lreadline" - "-lsqlite3" "-lgc" ]; @@ -30,10 +29,16 @@ stdenv.mkDerivation rec { buildInputs = [ makeWrapper nodejs-slim-8_x tzdata coreutils - openssl pcre readline sqlite boehmgc sfml + openssl pcre readline boehmgc sfml ]; + phases = [ "unpackPhase" "patchPhase" "buildPhase" "installPhase" "checkPhase" ]; + buildPhase = '' + # use gcc to trigger the linker since calling ld in build.sh causes an error + LD=gcc + # build.sh wants to write to $HOME/.cache + HOME=$TMPDIR sh build.sh ./bin/nim c koch ./koch boot -d:release \ @@ -51,7 +56,7 @@ stdenv.mkDerivation rec { --suffix PATH : ${lib.makeBinPath [ stdenv.cc ]} ''; - postPatch = + patchPhase = let disableTest = ''sed -i '1i discard \"\"\"\n disabled: true\n\"\"\"\n\n' ''; disableCompile = ''sed -i -e 's/^/#/' ''; in '' @@ -59,25 +64,12 @@ stdenv.mkDerivation rec { substituteInPlace ./tests/osproc/tworkingdir.nim --replace "/usr/bin" "${coreutils}/bin" substituteInPlace ./tests/stdlib/ttimes.nim --replace "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo" - # disable supposedly broken tests - ${disableTest} ./tests/errmsgs/tproper_stacktrace2.nim - ${disableTest} ./tests/vm/trgba.nim - # disable tests requiring network access (not available in the build container) ${disableTest} ./tests/stdlib/thttpclient.nim - ${disableTest} ./tests/cpp/tasync_cpp.nim - ${disableTest} ./tests/niminaction/Chapter7/Tweeter/src/tweeter.nim - - # disable tests requiring un-downloadable dependencies (using nimble, which isn't available in the fetch phase) - ${disableCompile} ./tests/manyloc/keineschweine/keineschweine.nim - ${disableTest} ./tests/manyloc/keineschweine/keineschweine.nim - ${disableCompile} ./tests/manyloc/nake/nakefile.nim - ${disableTest} ./tests/manyloc/nake/nakefile.nim - ${disableCompile} ./tests/manyloc/named_argument_bug/main.nim - ${disableTest} ./tests/manyloc/named_argument_bug/main.nim ''; checkPhase = '' + PATH=$PATH:$out/bin ./koch tests ''; From 89d71c5279196f593152b52f92f1a8580a41c87d Mon Sep 17 00:00:00 2001 From: royneary Date: Sat, 27 Oct 2018 16:58:44 +0200 Subject: [PATCH 2/7] nim: don't hardcode gcc --- pkgs/development/compilers/nim/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/nim/default.nix b/pkgs/development/compilers/nim/default.nix index 0d06f847ddf..28017006273 100644 --- a/pkgs/development/compilers/nim/default.nix +++ b/pkgs/development/compilers/nim/default.nix @@ -35,8 +35,8 @@ stdenv.mkDerivation rec { phases = [ "unpackPhase" "patchPhase" "buildPhase" "installPhase" "checkPhase" ]; buildPhase = '' - # use gcc to trigger the linker since calling ld in build.sh causes an error - LD=gcc + # use $CC to trigger the linker since calling ld in build.sh causes an error + LD=$CC # build.sh wants to write to $HOME/.cache HOME=$TMPDIR sh build.sh From 651c1784a943488b16dad56af7a382091f2e45e8 Mon Sep 17 00:00:00 2001 From: royneary Date: Sat, 27 Oct 2018 20:39:02 +0200 Subject: [PATCH 3/7] nim: disable test supposedly broken on Aarch64 --- pkgs/development/compilers/nim/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/development/compilers/nim/default.nix b/pkgs/development/compilers/nim/default.nix index 28017006273..3596c17b407 100644 --- a/pkgs/development/compilers/nim/default.nix +++ b/pkgs/development/compilers/nim/default.nix @@ -58,6 +58,7 @@ stdenv.mkDerivation rec { patchPhase = 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" @@ -66,6 +67,9 @@ stdenv.mkDerivation rec { # disable tests requiring network access (not available in the build container) ${disableTest} ./tests/stdlib/thttpclient.nim + '' + lib.optionalString stdenv.isAarch64 '' + # disable test supposedly broken on aarch64 + ${disableStdLibTest} ./lib/pure/stats.nim ''; checkPhase = '' From b786a47e9ebd8018079b094bdec4abbc7b785076 Mon Sep 17 00:00:00 2001 From: royneary Date: Wed, 31 Oct 2018 10:37:38 +0100 Subject: [PATCH 4/7] nim: move build time dependencies into nativeBuildInputs --- pkgs/development/compilers/nim/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/nim/default.nix b/pkgs/development/compilers/nim/default.nix index 3596c17b407..3f067553297 100644 --- a/pkgs/development/compilers/nim/default.nix +++ b/pkgs/development/compilers/nim/default.nix @@ -27,8 +27,11 @@ 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 - buildInputs = [ + nativeBuildInputs = [ makeWrapper nodejs-slim-8_x tzdata coreutils + ]; + + buildInputs = [ openssl pcre readline boehmgc sfml ]; From 9dcdf5a54564603ed47c6a8773edd4b08a5b2e8b Mon Sep 17 00:00:00 2001 From: royneary Date: Wed, 31 Oct 2018 10:38:16 +0100 Subject: [PATCH 5/7] nim: update nodejs-slim --- pkgs/development/compilers/nim/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/nim/default.nix b/pkgs/development/compilers/nim/default.nix index 3f067553297..ae36041b33e 100644 --- a/pkgs/development/compilers/nim/default.nix +++ b/pkgs/development/compilers/nim/default.nix @@ -1,6 +1,6 @@ # based on https://github.com/nim-lang/Nim/blob/v0.18.0/.travis.yml -{ stdenv, lib, fetchurl, makeWrapper, nodejs-slim-8_x, openssl, pcre, readline, boehmgc, sfml, tzdata, coreutils }: +{ stdenv, lib, fetchurl, makeWrapper, nodejs-slim-10_x, openssl, pcre, readline, boehmgc, sfml, tzdata, coreutils }: stdenv.mkDerivation rec { name = "nim-${version}"; @@ -28,7 +28,7 @@ stdenv.mkDerivation rec { # as part of building it, so it cannot be read-only nativeBuildInputs = [ - makeWrapper nodejs-slim-8_x tzdata coreutils + makeWrapper nodejs-slim-10_x tzdata coreutils ]; buildInputs = [ From bb2bae69868cf131d50e4e1012a74759a40f4c90 Mon Sep 17 00:00:00 2001 From: royneary Date: Wed, 31 Oct 2018 22:03:27 +0100 Subject: [PATCH 6/7] mosdeph: fix compilation with nim 0.19 --- pkgs/applications/science/biology/mosdepth/default.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/science/biology/mosdepth/default.nix b/pkgs/applications/science/biology/mosdepth/default.nix index 4b4920a6ca3..3cd83a5cdd2 100644 --- a/pkgs/applications/science/biology/mosdepth/default.nix +++ b/pkgs/applications/science/biology/mosdepth/default.nix @@ -4,8 +4,8 @@ let hts-nim = fetchFromGitHub { owner = "brentp"; repo = "hts-nim"; - rev = "9cd83e30522ab64cd71eb8209be4154aa5579ce1"; - sha256 = "10g408idy14667varq1syf06rrbpk63i3ib7i5dh1md4ib19av6f"; + rev = "v0.2.5"; + sha256 = "1fma99rjqxgg9dihkd10hm1jjp5amsk5wsxnvq1lk4mcsjix5xqb"; }; docopt = fetchFromGitHub { @@ -28,7 +28,10 @@ in stdenv.mkDerivation rec { buildInputs = [ nim ]; - buildPhase = "nim -p:${hts-nim}/src -p:${docopt}/src c -d:release mosdepth.nim"; + buildPhase = '' + HOME=$TMPDIR + nim -p:${hts-nim}/src -p:${docopt}/src c --nilseqs:on -d:release mosdepth.nim + ''; installPhase = "install -Dt $out/bin mosdepth"; fixupPhase = "patchelf --set-rpath ${stdenv.lib.makeLibraryPath [ stdenv.cc.cc htslib pcre ]} $out/bin/mosdepth"; From 18aa80f352914101827a98cab82460c89525c526 Mon Sep 17 00:00:00 2001 From: royneary Date: Wed, 31 Oct 2018 22:04:00 +0100 Subject: [PATCH 7/7] nrpl: fix compilation with nim 0.19 --- pkgs/development/tools/nrpl/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/development/tools/nrpl/default.nix b/pkgs/development/tools/nrpl/default.nix index d6a35723590..234f5a5bfae 100644 --- a/pkgs/development/tools/nrpl/default.nix +++ b/pkgs/development/tools/nrpl/default.nix @@ -25,7 +25,10 @@ stdenv.mkDerivation rec { "-lpcre" ]; - buildPhase = "nim c -d:release nrpl.nim"; + buildPhase = '' + HOME=$TMPDIR + nim c -d:release nrpl.nim + ''; installPhase = "install -Dt $out/bin nrpl";