1 { lib, fetchFromGitHub, erlang, makeWrapper, coreutils, bash, buildRebar3, buildHex }:
8 , src ? fetchFromGitHub { inherit rev sha256; owner = "rvirding"; repo = "lfe"; }
14 assertMsg makeBinPath optionalString
15 getVersion versionAtLeast versionOlder versions;
17 mainVersion = versions.major (getVersion erlang);
21 version = "1.1.1-beta";
23 sha256 = "0hnkhs761yjynw9382w8wm4j3x0r7lllzavaq2kh9n7qy3zc1rdx";
26 ${erlang}/bin/escript write_compile_flags include/compile_flags.hrl
31 assert (assertMsg (versionAtLeast maximumOTPVersion mainVersion)) ''
32 LFE ${version} is supported on OTP <=${maximumOTPVersion}, not ${mainVersion}.
40 buildInputs = [ erlang makeWrapper ];
41 beamDeps = [ proper ];
42 patches = [ ./no-test-deps.patch ./dedup-ebins.patch ] ++ patches;
44 checkTarget = "travis";
46 makeFlags = [ "-e" "MANDB=''" "PREFIX=$$out"];
48 # These installPhase tricks are based on Elixir's Makefile.
49 # TODO: Make, upload, and apply a patch.
50 installPhase = optionalString (versionOlder version "1.3") ''
51 local libdir=$out/lib/lfe
52 local ebindir=$libdir/ebin
53 local bindir=$libdir/bin
56 install -m755 -d $ebindir
57 install -m644 _build/default/lib/lfe/ebin/* $ebindir
59 install -m755 -d $bindir
61 for bin in bin/lfe{,c,doc,script}; do install -m755 $bin $bindir; done
63 install -m755 -d $out/bin
64 for file in $bindir/*; do ln -sf $file $out/bin/; done
67 # Thanks again, Elixir.
69 # LFE binaries are shell scripts which run erl and lfe.
70 # Add some stuff to PATH so the scripts can run without problems.
71 for f in $out/bin/*; do
73 --prefix PATH ":" "${makeBinPath [ erlang coreutils bash ]}:$out/bin"
74 substituteInPlace $f --replace "/usr/bin/env" "${coreutils}/bin/env"
79 description = "The best of Erlang and of Lisp; at the same time!";
81 LFE, Lisp Flavoured Erlang, is a lisp syntax front-end to the Erlang
82 compiler. Code produced with it is compatible with "normal" Erlang
83 code. An LFE evaluator and shell is also included.
86 homepage = "http://lfe.io";
87 downloadPage = "https://github.com/rvirding/lfe/releases";
89 license = licenses.asl20;
90 maintainers = teams.beam.members;
91 platforms = platforms.unix;