anchor.diff:      url = "https://nim-lang.org/download/${pname}-${version}.tar.xz";
       sha256 = "1rjinrs119c8i6wzz5fzjfml7n7kbd5hb9642g4rr8qxkq4sx83k";
     };
  -
  -  doCheck = !stdenv.isDarwin;
   
     enableParallelBuilding = true;
   
  
positive.code:     ./koch tools -d:release
  
      runHook postBuild
    '';
  
    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/osproc/tworkingdir.nim --replace "/usr/bin" "${coreutils}/bin"
        substituteInPlace ./tests/stdlib/ttimes.nim --replace "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo"
  
        # 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 ''
        # 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
  
        # reported upstream: https://github.com/nim-lang/Nim/issues/12262
        ${disableTest} ./tests/range/tcompiletime_range_checks.nim
  
        # requires "immintrin.h" which is available only on x86
        ${disableTest} ./tests/misc/tsizeof3.nim
      '';
  
    checkPhase = ''
      runHook preCheck
  
      # Fortify hardening breaks tests
      # https://github.com/nim-lang/Nim/issues/11435#issuecomment-534545696
      NIX_HARDENING_ENABLE=''${NIX_HARDENING_ENABLE/fortify/} \
      ./koch tests --nim:bin/nim all
  
      runHook postCheck
    '';
  
    installPhase = ''
  
negative.code: # based on https://github.com/nim-lang/Nim/blob/v0.18.0/.travis.yml
  
  { stdenv, lib, fetchurl, makeWrapper, openssl, pcre, readline,
    boehmgc, sfml, sqlite }:
  
  stdenv.mkDerivation rec {
    pname = "nim";
  