Skip to content
Permalink
Browse files

wip

  • Loading branch information
peterhoeg committed Jan 5, 2019
1 parent 201d739 commit 342efa6cc62129b9f2a88f48e6c420ff138d8145
Showing with 19 additions and 4 deletions.
  1. +19 −4 pkgs/development/compilers/nim/default.nix
@@ -35,9 +35,11 @@ stdenv.mkDerivation rec {
openssl pcre readline boehmgc sfml
];

phases = [ "unpackPhase" "patchPhase" "buildPhase" "installPhase" "checkPhase" ];
# phases = [ "unpackPhase" "patchPhase" "buildPhase" "installPhase" "checkPhase" ];

buildPhase = ''
runHook preBuild
# 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
@@ -48,25 +50,34 @@ stdenv.mkDerivation rec {
-d:useGnuReadline \
${lib.optionals (stdenv.isDarwin || stdenv.isLinux) "-d:nativeStacktrace"}
./koch tools -d:release
runHook postBuild
'';

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
'';

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"
substituteInPlace ./tests/osproc/tworkingdir.nim --replace "/usr/bin" "${coreutils}/bin"
substituteInPlace ./tests/stdlib/ttimes.nim --replace "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo"
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)
${disableTest} ./tests/stdlib/thttpclient.nim
@@ -76,8 +87,12 @@ stdenv.mkDerivation rec {
'';

checkPhase = ''
runHook preCheck
PATH=$PATH:$out/bin
./koch tests
runHook postCheck
'';

meta = with stdenv.lib; {

0 comments on commit 342efa6

Please sign in to comment.
You can’t perform that action at this time.