diff options
author | Peter Hoeg <peter@speartail.com> | 2017-01-12 18:08:48 +0800 |
---|---|---|
committer | Peter Hoeg <peter@speartail.com> | 2017-01-12 20:11:36 +0800 |
commit | 4e0a5e7602bd437e5c6be3f2405f49bfb3ff4f5a (patch) | |
tree | a6a504a4d4c377830f1aa192aee33631fe84564d /pkgs/development/compilers/nim | |
parent | f673243aff0bc9ae4d2e96ccd60124ff9fe5b103 (diff) | |
download | nixlib-4e0a5e7602bd437e5c6be3f2405f49bfb3ff4f5a.tar nixlib-4e0a5e7602bd437e5c6be3f2405f49bfb3ff4f5a.tar.gz nixlib-4e0a5e7602bd437e5c6be3f2405f49bfb3ff4f5a.tar.bz2 nixlib-4e0a5e7602bd437e5c6be3f2405f49bfb3ff4f5a.tar.lz nixlib-4e0a5e7602bd437e5c6be3f2405f49bfb3ff4f5a.tar.xz nixlib-4e0a5e7602bd437e5c6be3f2405f49bfb3ff4f5a.tar.zst nixlib-4e0a5e7602bd437e5c6be3f2405f49bfb3ff4f5a.zip |
nim: include all supporting tools
This PR makes a few changes to how things are done: a) build and install "koch" - the nim make-type tool b) use "koch" to bootstrap nim c) build additional supporting tools such as nimble, nimgrep and nimsuggest d) nim can use other c compilers than gcc, so instead of forcing gcc we use the one from stdenv e) run the full test suite We do not need the "nimble" package any longer as it is part of nim.
Diffstat (limited to 'pkgs/development/compilers/nim')
-rw-r--r-- | pkgs/development/compilers/nim/default.nix | 70 |
1 files changed, 49 insertions, 21 deletions
diff --git a/pkgs/development/compilers/nim/default.nix b/pkgs/development/compilers/nim/default.nix index eed702f85128..0cebd40afdba 100644 --- a/pkgs/development/compilers/nim/default.nix +++ b/pkgs/development/compilers/nim/default.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, fetchurl, makeWrapper, gcc }: +{ stdenv, lib, fetchurl, makeWrapper, nodejs, openssl, pcre, readline, sqlite }: stdenv.mkDerivation rec { name = "nim-${version}"; @@ -9,24 +9,52 @@ stdenv.mkDerivation rec { sha256 = "0rsibhkc5n548bn9yyb9ycrdgaph5kq84sfxc9gabjs7pqirh6cy"; }; - buildInputs = [ makeWrapper ]; - - buildPhase = "sh build.sh"; - - installPhase = - '' - install -Dt "$out/bin" bin/nim - substituteInPlace install.sh --replace '$1/nim' "$out" - sh install.sh $out - wrapProgram $out/bin/nim \ - --suffix PATH : ${lib.makeBinPath [ gcc ]} - ''; - - meta = with stdenv.lib; - { description = "Statically typed, imperative programming language"; - homepage = http://nim-lang.org/; - license = licenses.mit; - maintainers = with maintainers; [ ehmry peterhoeg ]; - platforms = platforms.linux ++ platforms.darwin; # arbitrary - }; + doCheck = true; + + enableParallelBuilding = true; + + NIX_LDFLAGS = [ + "-lcrypto" + "-lpcre" + "-lreadline" + "-lsqlite3" + ]; + + # 1. nodejs is only needed for tests + # 2. we could create a separate derivation for the "written in c" version of nim + # used for bootstrapping, but koch insists on moving the nim compiler around + # as part of building it, so it cannot be read-only + + buildInputs = [ + makeWrapper nodejs + openssl pcre readline sqlite + ]; + + buildPhase = '' + sh build.sh + ./bin/nim c koch + ./koch boot -d:release \ + -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 ]} + ''; + + checkPhase = "./koch tests"; + + meta = with stdenv.lib; { + description = "Statically typed, imperative programming language"; + homepage = http://nim-lang.org/; + license = licenses.mit; + maintainers = with maintainers; [ ehmry peterhoeg ]; + platforms = with platforms; linux ++ darwin; # arbitrary + }; } |