Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at netboot-syslinux-multiplatform 79 lines 2.0 kB view raw
1{ pkgs 2, lib 3, stdenv 4, fetchFromGitHub 5, erlang 6, makeWrapper 7, coreutils 8, curl 9, bash 10, debugInfo ? false 11}: 12 13{ baseName ? "elixir" 14, version 15, minimumOTPVersion 16, sha256 ? null 17, rev ? "v${version}" 18, src ? fetchFromGitHub { inherit rev sha256; owner = "elixir-lang"; repo = "elixir"; } 19} @ args: 20 21let 22 inherit (lib) getVersion versionAtLeast optional; 23 24in 25assert versionAtLeast (getVersion erlang) minimumOTPVersion; 26 27stdenv.mkDerivation ({ 28 pname = "${baseName}"; 29 30 inherit src version debugInfo; 31 32 nativeBuildInputs = [ makeWrapper ]; 33 buildInputs = [ erlang ]; 34 35 LANG = "C.UTF-8"; 36 LC_TYPE = "C.UTF-8"; 37 38 buildFlags = optional debugInfo "ERL_COMPILER_OPTIONS=debug_info"; 39 40 preBuild = '' 41 patchShebangs lib/elixir/generate_app.escript || true 42 43 substituteInPlace Makefile \ 44 --replace "/usr/local" $out 45 ''; 46 47 postFixup = '' 48 # Elixir binaries are shell scripts which run erl. Add some stuff 49 # to PATH so the scripts can run without problems. 50 51 for f in $out/bin/*; do 52 b=$(basename $f) 53 if [ "$b" = mix ]; then continue; fi 54 wrapProgram $f \ 55 --prefix PATH ":" "${lib.makeBinPath [ erlang coreutils curl bash ]}" 56 done 57 58 substituteInPlace $out/bin/mix \ 59 --replace "/usr/bin/env elixir" "${coreutils}/bin/env elixir" 60 ''; 61 62 pos = builtins.unsafeGetAttrPos "sha256" args; 63 meta = with lib; { 64 homepage = "https://elixir-lang.org/"; 65 description = "A functional, meta-programming aware language built on top of the Erlang VM"; 66 67 longDescription = '' 68 Elixir is a functional, meta-programming aware language built on 69 top of the Erlang VM. It is a dynamic language with flexible 70 syntax and macro support that leverages Erlang's abilities to 71 build concurrent, distributed and fault-tolerant applications 72 with hot code upgrades. 73 ''; 74 75 license = licenses.epl10; 76 platforms = platforms.unix; 77 maintainers = teams.beam.members; 78 }; 79})