nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 bash,
3 buildHex,
4 buildRebar3,
5 config,
6 coreutils,
7 erlang,
8 fetchFromGitHub,
9 lib,
10 makeWrapper,
11}:
12
13let
14 inherit (lib)
15 assertMsg
16 makeBinPath
17 getVersion
18 versionAtLeast
19 versions
20 ;
21
22 version = "2.2.0";
23 hash = "sha256-47lEUVU9Api1Yj1q+Ch8aIV8kaALhst1ty8RHTwMVcI=";
24
25 maximumOTPVersion = "27";
26 mainVersion = versions.major (getVersion erlang);
27 maxAssert = versionAtLeast maximumOTPVersion mainVersion;
28
29 proper = buildHex {
30 name = "proper";
31 version = "1.4.0";
32
33 sha256 = "sha256-GChYQhhb0z772pfRNKXLWgiEOE2zYRn+4OPPpIhWjLs=";
34 };
35
36in
37if !config.allowAliases && !maxAssert then
38 # Don't throw without aliases to not break CI.
39 null
40else
41 assert assertMsg maxAssert ''
42 LFE ${version} is supported on OTP <=${maximumOTPVersion}, not ${mainVersion}.
43 '';
44 buildRebar3 {
45 name = "lfe";
46 inherit version;
47
48 src = fetchFromGitHub {
49 owner = "lfe";
50 repo = "lfe";
51 tag = "v${version}";
52 inherit hash;
53 };
54
55 patches = [
56 ./fix-rebar-config.patch
57 ./dedup-ebins.patch
58 ];
59
60 nativeBuildInputs = [
61 makeWrapper
62 erlang
63 ];
64
65 beamDeps = [ proper ];
66
67 makeFlags = [
68 "-e"
69 "MANDB=''"
70 "PREFIX=$$out"
71 ];
72
73 # override buildRebar3's install to let the builder use make install
74 installPhase = "";
75
76 doCheck = true;
77 checkTarget = "travis";
78
79 postFixup = ''
80 # LFE binaries are shell scripts which run erl and lfe.
81 # Add some stuff to PATH so the scripts can run without problems.
82 for f in $out/bin/*; do
83 wrapProgram $f \
84 --prefix PATH ":" "${
85 makeBinPath [
86 erlang
87 coreutils
88 bash
89 ]
90 }:$out/bin"
91 substituteInPlace $f --replace "/usr/bin/env" "${coreutils}/bin/env"
92 done
93 '';
94
95 meta = {
96 description = "Best of Erlang and of Lisp; at the same time";
97 longDescription = ''
98 LFE, Lisp Flavoured Erlang, is a lisp syntax front-end to the Erlang
99 compiler. Code produced with it is compatible with "normal" Erlang
100 code. An LFE evaluator and shell is also included.
101 '';
102
103 homepage = "https://lfe.io";
104 downloadPage = "https://github.com/lfe/lfe/releases";
105 changelog = "https://github.com/lfe/lfe/releases/tag/v${version}";
106
107 license = lib.licenses.asl20;
108 teams = [ lib.teams.beam ];
109 platforms = lib.platforms.unix;
110 };
111 }