at 18.03-beta 60 lines 1.6 kB view raw
1{ stdenv, lib, fetchurl, makeWrapper, nodejs, openssl, pcre, readline, sqlite }: 2 3stdenv.mkDerivation rec { 4 name = "nim-${version}"; 5 version = "0.17.2"; 6 7 src = fetchurl { 8 url = "https://nim-lang.org/download/${name}.tar.xz"; 9 sha256 = "1gc2xk3ygmz9y4pm75pligssgw995a7gvnfpy445fjpw4d81pzxa"; 10 }; 11 12 doCheck = true; 13 14 enableParallelBuilding = true; 15 16 NIX_LDFLAGS = [ 17 "-lcrypto" 18 "-lpcre" 19 "-lreadline" 20 "-lsqlite3" 21 ]; 22 23 # 1. nodejs is only needed for tests 24 # 2. we could create a separate derivation for the "written in c" version of nim 25 # used for bootstrapping, but koch insists on moving the nim compiler around 26 # as part of building it, so it cannot be read-only 27 28 buildInputs = [ 29 makeWrapper nodejs 30 openssl pcre readline sqlite 31 ]; 32 33 buildPhase = '' 34 sh build.sh 35 ./bin/nim c koch 36 ./koch boot -d:release \ 37 -d:useGnuReadline \ 38 ${lib.optionals (stdenv.isDarwin || stdenv.isLinux) "-d:nativeStacktrace"} 39 ./koch tools -d:release 40 ''; 41 42 installPhase = '' 43 install -Dt $out/bin bin/* koch 44 ./koch install $out 45 mv $out/nim/bin/* $out/bin/ && rmdir $out/nim/bin 46 mv $out/nim/* $out/ && rmdir $out/nim 47 wrapProgram $out/bin/nim \ 48 --suffix PATH : ${lib.makeBinPath [ stdenv.cc ]} 49 ''; 50 51 checkPhase = "./koch tests"; 52 53 meta = with stdenv.lib; { 54 description = "Statically typed, imperative programming language"; 55 homepage = https://nim-lang.org/; 56 license = licenses.mit; 57 maintainers = with maintainers; [ ehmry peterhoeg ]; 58 platforms = with platforms; linux ++ darwin; # arbitrary 59 }; 60}