1{ stdenv, fetchurl, erlang, rebar, makeWrapper, coreutils, curl, bash }:
2
3let
4 version = "1.0.5";
5in
6stdenv.mkDerivation {
7 name = "elixir-${version}";
8
9 src = fetchurl {
10 url = "https://github.com/elixir-lang/elixir/archive/v${version}.tar.gz";
11 sha256 = "1f419pzlcgqx68rygwwyp2hzh4vgp0avjydd84dpa7finckc5raw";
12 };
13
14 buildInputs = [ erlang rebar makeWrapper ];
15
16 preBuild = ''
17 # The build process uses ./rebar. Link it to the nixpkgs rebar
18 rm -v rebar
19 ln -s ${rebar}/bin/rebar rebar
20
21 substituteInPlace Makefile \
22 --replace "/usr/local" $out
23 '';
24
25 postFixup = ''
26 # Elixir binaries are shell scripts which run erl. Add some stuff
27 # to PATH so the scripts can run without problems.
28
29 for f in $out/bin/*; do
30 b=$(basename $f)
31 if [ $b == "mix" ]; then continue; fi
32 wrapProgram $f \
33 --prefix PATH ":" "${erlang}/bin:${coreutils}/bin:${curl}/bin:${bash}/bin" \
34 --set CURL_CA_BUNDLE /etc/ssl/certs/ca-certificates.crt
35 done
36
37 substituteInPlace $out/bin/mix \
38 --replace "/usr/bin/env elixir" "${coreutils}/bin/env $out/bin/elixir"
39 '';
40
41 meta = with stdenv.lib; {
42 homepage = "http://elixir-lang.org/";
43 description = "A functional, meta-programming aware language built on top of the Erlang VM";
44
45 longDescription = ''
46 Elixir is a functional, meta-programming aware language built on
47 top of the Erlang VM. It is a dynamic language with flexible
48 syntax and macro support that leverages Erlang's abilities to
49 build concurrent, distributed and fault-tolerant applications
50 with hot code upgrades.
51 '';
52
53 license = licenses.epl10;
54 platforms = platforms.unix;
55 maintainers = [ maintainers.the-kenny ];
56 };
57}