Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 16.09 71 lines 2.1 kB view raw
1{ stdenv, fetchFromGitHub, erlang, rebar, makeWrapper, coreutils, curl, bash, 2 debugInfo ? false }: 3 4stdenv.mkDerivation rec { 5 name = "elixir-${version}"; 6 version = "1.3.1"; 7 8 src = fetchFromGitHub { 9 owner = "elixir-lang"; 10 repo = "elixir"; 11 rev = "v${version}"; 12 sha256 = "0pihqgsnddrhhcpiphz170wgwlc59pd492iy4f66dajapm5k329d"; 13 }; 14 15 buildInputs = [ erlang rebar makeWrapper ]; 16 17 # Elixir expects that UTF-8 locale to be set (see https://github.com/elixir-lang/elixir/issues/3548). 18 # In other cases there is warnings during compilation. 19 LANG = "en_US.UTF-8"; 20 LC_TYPE = "en_US.UTF-8"; 21 22 setupHook = ./setup-hook.sh; 23 24 inherit debugInfo; 25 26 buildFlags = if debugInfo 27 then "ERL_COMPILER_OPTIONS=debug_info" 28 else ""; 29 30 preBuild = '' 31 # The build process uses ./rebar. Link it to the nixpkgs rebar 32 rm -v rebar 33 ln -s ${rebar}/bin/rebar rebar 34 35 substituteInPlace Makefile \ 36 --replace "/usr/local" $out 37 ''; 38 39 postFixup = '' 40 # Elixir binaries are shell scripts which run erl. Add some stuff 41 # to PATH so the scripts can run without problems. 42 43 for f in $out/bin/*; do 44 b=$(basename $f) 45 if [ $b == "mix" ]; then continue; fi 46 wrapProgram $f \ 47 --prefix PATH ":" "${stdenv.lib.makeBinPath [ erlang coreutils curl bash ]}" \ 48 --set CURL_CA_BUNDLE /etc/ssl/certs/ca-certificates.crt 49 done 50 51 substituteInPlace $out/bin/mix \ 52 --replace "/usr/bin/env elixir" "${coreutils}/bin/env elixir" 53 ''; 54 55 meta = with stdenv.lib; { 56 homepage = "http://elixir-lang.org/"; 57 description = "A functional, meta-programming aware language built on top of the Erlang VM"; 58 59 longDescription = '' 60 Elixir is a functional, meta-programming aware language built on 61 top of the Erlang VM. It is a dynamic language with flexible 62 syntax and macro support that leverages Erlang's abilities to 63 build concurrent, distributed and fault-tolerant applications 64 with hot code upgrades. 65 ''; 66 67 license = licenses.epl10; 68 platforms = platforms.unix; 69 maintainers = with maintainers; [ the-kenny havvy couchemar ]; 70 }; 71}