@@ -0,0 +1,44 @@
1+{ stdenv, lib, fetchFromGitHub, fetchpatch, makeWrapper, nim, pcre, tinycc }:
2+
3+stdenv.mkDerivation rec {
4+ name = "nrpl-${version}";
5+ version = "20150522";
6+
7+ src = fetchFromGitHub {
8+ owner = "wheineman";
9+ repo = "nrpl";
10+ rev = "6d6c189ab7d1c905cc29dc678d66e9e132026f69";
11+ sha256 = "1cly9lhrawnc42r31b7r0p0i6hcx8r00aa17gv7w9pcpj8ngb4v2";
12+ };
13+
14+ buildInputs = [ makeWrapper nim pcre ];
15+
16+ patches = [
17+ (fetchpatch {
18+ url = https://patch-diff.githubusercontent.com/raw/wheineman/nrpl/pull/12.patch;
19+ name = "update_for_new_nim.patch";
20+ sha256 = "1zff7inhn3l1jnxcnidy705lzi3wqib1chf4rayh1g9i23an7wg1";
21+ })
22+ ];
23+
24+ NIX_LDFLAGS = [
25+ "-lpcre"
26+ ];
27+
28+ buildPhase = "nim c -d:release nrpl.nim";
29+
30+ installPhase = "install -Dt $out/bin nrpl";
31+
32+ postFixup = ''
33+ wrapProgram $out/bin/nrpl \
34+ --prefix PATH : ${lib.makeBinPath [ nim tinycc ]}
35+ '';
36+
37+ meta = with stdenv.lib; {
38+ description = "REPL for the Nim programming language";
39+ homepage = https://github.com/wheineman/nrpl;
40+ license = licenses.mit;
41+ maintainers = with maintainers; [ peterhoeg ];
42+ platforms = with platforms; linux ++ darwin;
43+ };
44+}