mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-20 04:31:52 +00:00
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.
This commit is contained in:
parent
f673243aff
commit
4e0a5e7602
|
@ -1,4 +1,4 @@
|
||||||
{ stdenv, lib, fetchurl, makeWrapper, gcc }:
|
{ stdenv, lib, fetchurl, makeWrapper, nodejs, openssl, pcre, readline, sqlite }:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "nim-${version}";
|
name = "nim-${version}";
|
||||||
|
@ -9,24 +9,52 @@ stdenv.mkDerivation rec {
|
||||||
sha256 = "0rsibhkc5n548bn9yyb9ycrdgaph5kq84sfxc9gabjs7pqirh6cy";
|
sha256 = "0rsibhkc5n548bn9yyb9ycrdgaph5kq84sfxc9gabjs7pqirh6cy";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [ makeWrapper ];
|
doCheck = true;
|
||||||
|
|
||||||
buildPhase = "sh build.sh";
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
installPhase =
|
NIX_LDFLAGS = [
|
||||||
''
|
"-lcrypto"
|
||||||
install -Dt "$out/bin" bin/nim
|
"-lpcre"
|
||||||
substituteInPlace install.sh --replace '$1/nim' "$out"
|
"-lreadline"
|
||||||
sh install.sh $out
|
"-lsqlite3"
|
||||||
wrapProgram $out/bin/nim \
|
];
|
||||||
--suffix PATH : ${lib.makeBinPath [ gcc ]}
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with stdenv.lib;
|
# 1. nodejs is only needed for tests
|
||||||
{ description = "Statically typed, imperative programming language";
|
# 2. we could create a separate derivation for the "written in c" version of nim
|
||||||
homepage = http://nim-lang.org/;
|
# used for bootstrapping, but koch insists on moving the nim compiler around
|
||||||
license = licenses.mit;
|
# as part of building it, so it cannot be read-only
|
||||||
maintainers = with maintainers; [ ehmry peterhoeg ];
|
|
||||||
platforms = platforms.linux ++ platforms.darwin; # arbitrary
|
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
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
{ stdenv, fetchFromGitHub, nim, openssl }:
|
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
name = "nimble-${version}";
|
|
||||||
|
|
||||||
version = "0.7.10";
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "nim-lang";
|
|
||||||
repo = "nimble";
|
|
||||||
rev = "v${version}";
|
|
||||||
sha256 = "1bcv8chir73nn6x7q8n3sw2scf3m0x2w9gkkzx162ryivza1nm1r";
|
|
||||||
};
|
|
||||||
|
|
||||||
buildInputs = [ nim openssl ];
|
|
||||||
|
|
||||||
patchPhase = ''
|
|
||||||
substituteInPlace src/nimble.nim.cfg --replace "./vendor/nim" "${nim}/share"
|
|
||||||
echo "--clib:crypto" >> src/nimble.nim.cfg
|
|
||||||
'';
|
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
cd src && nim c -d:release nimble
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out/bin
|
|
||||||
cp nimble $out/bin
|
|
||||||
'';
|
|
||||||
|
|
||||||
dontStrip = true;
|
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
|
||||||
description = "Package manager for the Nim programming language";
|
|
||||||
homepage = https://github.com/nim-lang/nimble;
|
|
||||||
license = licenses.bsd2;
|
|
||||||
maintainers = with maintainers; [ kamilchm ];
|
|
||||||
platforms = platforms.linux ++ platforms.darwin;
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -5277,7 +5277,6 @@ in
|
||||||
mozart = mozart-binary;
|
mozart = mozart-binary;
|
||||||
|
|
||||||
nim = callPackage ../development/compilers/nim { };
|
nim = callPackage ../development/compilers/nim { };
|
||||||
nimble = callPackage ../development/tools/nimble { };
|
|
||||||
nrpl = callPackage ../development/tools/nrpl { };
|
nrpl = callPackage ../development/tools/nrpl { };
|
||||||
|
|
||||||
neko = callPackage ../development/compilers/neko { };
|
neko = callPackage ../development/compilers/neko { };
|
||||||
|
@ -8401,7 +8400,7 @@ in
|
||||||
|
|
||||||
libpfm = callPackage ../development/libraries/libpfm { };
|
libpfm = callPackage ../development/libraries/libpfm { };
|
||||||
|
|
||||||
libpqxx = callPackage ../development/libraries/libpqxx {
|
libpqxx = callPackage ../development/libraries/libpqxx {
|
||||||
gnused = gnused_422;
|
gnused = gnused_422;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue