nixpkgs/pkgs/development/interpreters/lfe/generic-builder.nix

64 lines
1.8 KiB
Nix
Raw Normal View History

2017-07-11 02:25:12 +02:00
{ stdenv, fetchFromGitHub, erlang, makeWrapper, coreutils, bash, buildRebar3 }:
2017-07-11 02:25:12 +02:00
{ baseName ? "lfe"
, version
, sha256 ? null
, rev ? version
, src ? fetchFromGitHub { inherit rev sha256; owner = "rvirding"; repo = "lfe"; }
}:
2017-07-11 02:25:12 +02:00
buildRebar3 {
name = "${baseName}";
2017-07-11 02:25:12 +02:00
inherit src version;
2017-07-11 02:25:12 +02:00
buildInputs = [ erlang makeWrapper ];
patches = [ ./no-test-deps.patch ];
# These installPhase tricks are based on Elixir's Makefile.
# TODO: Make, upload, and apply a patch.
installPhase = ''
local libdir=$out/lib/lfe
local ebindir=$libdir/ebin
local bindir=$libdir/bin
rm -Rf $ebindir
install -m755 -d $ebindir
install -m644 _build/default/lib/lfe/ebin/* $ebindir
install -m755 -d $bindir
2017-07-11 02:25:12 +02:00
for bin in bin/lfe{,c,doc,script}; do install -m755 $bin $bindir; done
install -m755 -d $out/bin
for file in $bindir/*; do ln -sf $file $out/bin/; done
'';
# Thanks again, Elixir.
postFixup = ''
# LFE binaries are shell scripts which run erl and lfe.
# Add some stuff to PATH so the scripts can run without problems.
for f in $out/bin/*; do
wrapProgram $f \
2016-08-23 00:06:51 +02:00
--prefix PATH ":" "${stdenv.lib.makeBinPath [ erlang coreutils bash ]}:$out/bin"
substituteInPlace $f --replace "/usr/bin/env" "${coreutils}/bin/env"
done
'';
meta = with stdenv.lib; {
description = "The best of Erlang and of Lisp; at the same time!";
longDescription = ''
LFE, Lisp Flavoured Erlang, is a lisp syntax front-end to the Erlang
compiler. Code produced with it is compatible with "normal" Erlang
code. An LFE evaluator and shell is also included.
'';
homepage = "http://lfe.io";
downloadPage = "https://github.com/rvirding/lfe/releases";
license = licenses.asl20;
2017-07-11 02:25:12 +02:00
maintainers = with maintainers; [ yurrriq ankhers ];
platforms = platforms.unix;
};
}