From 019afb0c806301e03de764a77dcc11fcbc3fd77a Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Thu, 22 Jun 2017 20:34:32 -0400 Subject: [PATCH 01/11] Generalize building of Elixir interpreter --- lib/maintainers.nix | 1 + pkgs/development/beam-modules/default.nix | 13 +++++++-- pkgs/development/beam-modules/lib.nix | 8 +++++ pkgs/development/interpreters/elixir/1.3.nix | 6 ++++ pkgs/development/interpreters/elixir/1.4.nix | 6 ++++ .../{default.nix => generic-builder.nix} | 29 +++++++++---------- pkgs/top-level/beam-packages.nix | 3 ++ 7 files changed, 48 insertions(+), 18 deletions(-) create mode 100644 pkgs/development/interpreters/elixir/1.3.nix create mode 100644 pkgs/development/interpreters/elixir/1.4.nix rename pkgs/development/interpreters/elixir/{default.nix => generic-builder.nix} (75%) diff --git a/lib/maintainers.nix b/lib/maintainers.nix index 328a5d772db3..2c56949229bd 100644 --- a/lib/maintainers.nix +++ b/lib/maintainers.nix @@ -42,6 +42,7 @@ andrewrk = "Andrew Kelley "; andsild = "Anders Sildnes "; aneeshusa = "Aneesh Agrawal "; + ankhers = "Justin Wood "; antono = "Antono Vasiljev "; apeschar = "Albert Peschar "; apeyroux = "Alexandre Peyroux "; diff --git a/pkgs/development/beam-modules/default.nix b/pkgs/development/beam-modules/default.nix index d1a2a785a9c9..26cba333c23d 100644 --- a/pkgs/development/beam-modules/default.nix +++ b/pkgs/development/beam-modules/default.nix @@ -37,9 +37,16 @@ let buildMix = callPackage ./build-mix.nix {}; # BEAM-based languages. - elixir = if versionAtLeast (lib.getVersion erlang) "18" - then callPackage ../interpreters/elixir { debugInfo = true; } - else throw "Elixir requires at least Erlang/OTP R18."; + elixir = defaultScope.elixir-1_4; + + elixir-1_4 = if versionAtLeast (lib.getVersion erlang) "18" + then lib.callElixir ../interpreters/elixir/1.4.nix { debugInfo = true; } + else throw "Elixir requires at least Erlang/OTP R18."; + + elixir-1_3 = if versionAtLeast (lib.getVersion erlang) "18" + then lib.callElixir ../interpreters/elixir/1.3.nix { debugInfo = true; } + else throw "Elixir requires at least Erlang/OTP R18."; + lfe = callPackage ../interpreters/lfe { }; # Non hex packages diff --git a/pkgs/development/beam-modules/lib.nix b/pkgs/development/beam-modules/lib.nix index 009bfb4975b6..9d7a4bbd34ed 100644 --- a/pkgs/development/beam-modules/lib.nix +++ b/pkgs/development/beam-modules/lib.nix @@ -43,4 +43,12 @@ rec { mkDerivation = pkgs.makeOverridable builder; }; + callElixir = drv: args: + let + builder = callPackage ../../development/interpreters/elixir/generic-builder.nix args; + in + callPackage drv { + mkDerivation = pkgs.makeOverridable builder; + }; + } diff --git a/pkgs/development/interpreters/elixir/1.3.nix b/pkgs/development/interpreters/elixir/1.3.nix new file mode 100644 index 000000000000..90d81ee0120b --- /dev/null +++ b/pkgs/development/interpreters/elixir/1.3.nix @@ -0,0 +1,6 @@ +{ mkDerivation }: + +mkDerivation rec { + version = "1.3.4"; + sha256 = "01qqv1ghvfadcwcr5p88w8j217cgaf094pmpqllij3l0q1yg104l"; +} diff --git a/pkgs/development/interpreters/elixir/1.4.nix b/pkgs/development/interpreters/elixir/1.4.nix new file mode 100644 index 000000000000..2729c9942208 --- /dev/null +++ b/pkgs/development/interpreters/elixir/1.4.nix @@ -0,0 +1,6 @@ +{ mkDerivation }: + +mkDerivation rec { + version = "1.4.5"; + sha256 = "18ivcxmh5bak13k3rjy7jjzin57rgb2nffhwnqb2wl7bpi8mrarw"; +} diff --git a/pkgs/development/interpreters/elixir/default.nix b/pkgs/development/interpreters/elixir/generic-builder.nix similarity index 75% rename from pkgs/development/interpreters/elixir/default.nix rename to pkgs/development/interpreters/elixir/generic-builder.nix index 0e77b2af2524..60f044e16d0f 100644 --- a/pkgs/development/interpreters/elixir/default.nix +++ b/pkgs/development/interpreters/elixir/generic-builder.nix @@ -1,21 +1,20 @@ -{ stdenv, fetchFromGitHub, erlang, rebar, makeWrapper, coreutils, curl, bash, - debugInfo ? false }: +{ pkgs, stdenv, fetchFromGitHub, erlang, rebar, makeWrapper, coreutils, curl +, bash, debugInfo ? false }: -stdenv.mkDerivation rec { - name = "elixir-${version}"; - version = "1.4.4"; +{ baseName ? "elixir" +, version +, sha256 ? null +, rev ? "v${version}" +, src ? fetchFromGitHub { inherit rev sha256; owner = "elixir-lang"; repo = "elixir"; } +}: - src = fetchFromGitHub { - owner = "elixir-lang"; - repo = "elixir"; - rev = "v${version}"; - sha256 = "0m51cirkv1dahw4z2jlmz58cwmpy0dya88myx4wykq0v5bh1xbq8"; - }; +stdenv.mkDerivation ({ + name = "${baseName}-${version}"; + + inherit src version; buildInputs = [ erlang rebar makeWrapper ]; - # Elixir expects that UTF-8 locale to be set (see https://github.com/elixir-lang/elixir/issues/3548). - # In other cases there is warnings during compilation. LANG = "en_US.UTF-8"; LC_TYPE = "en_US.UTF-8"; @@ -66,6 +65,6 @@ stdenv.mkDerivation rec { license = licenses.epl10; platforms = platforms.unix; - maintainers = with maintainers; [ the-kenny havvy couchemar ]; + maintainers = with maintainers; [ the-kenny havvy couchemar ankhers ]; }; -} +}) diff --git a/pkgs/top-level/beam-packages.nix b/pkgs/top-level/beam-packages.nix index acdbea673328..877feaee8710 100644 --- a/pkgs/top-level/beam-packages.nix +++ b/pkgs/top-level/beam-packages.nix @@ -57,6 +57,9 @@ rec { # access for example elixir built with different version of Erlang, use # `beam.packages.erlangR19.elixir`. elixir = packages.erlang.elixir; + elixir-1_4 = packages.erlang.elixir-1_4; + elixir-1_3 = packages.erlang.elixir-1_3; + lfe = packages.erlang.lfe; }; From 838956b179f786eb27a0d21eeddd5909f083ee29 Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Thu, 22 Jun 2017 21:17:25 -0400 Subject: [PATCH 02/11] Add erlang that is in scope --- pkgs/development/beam-modules/default.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkgs/development/beam-modules/default.nix b/pkgs/development/beam-modules/default.nix index 26cba333c23d..d54520212a51 100644 --- a/pkgs/development/beam-modules/default.nix +++ b/pkgs/development/beam-modules/default.nix @@ -40,11 +40,19 @@ let elixir = defaultScope.elixir-1_4; elixir-1_4 = if versionAtLeast (lib.getVersion erlang) "18" - then lib.callElixir ../interpreters/elixir/1.4.nix { debugInfo = true; } + then + lib.callElixir ../interpreters/elixir/1.4.nix { + debugInfo = true; + erlang = erlang; + } else throw "Elixir requires at least Erlang/OTP R18."; elixir-1_3 = if versionAtLeast (lib.getVersion erlang) "18" - then lib.callElixir ../interpreters/elixir/1.3.nix { debugInfo = true; } + then + lib.callElixir ../interpreters/elixir/1.3.nix { + debugInfo = true; + erlang = erlang; + } else throw "Elixir requires at least Erlang/OTP R18."; lfe = callPackage ../interpreters/lfe { }; From 3595f8e8d69e10b4989052e52ba4f08ce30857d2 Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Fri, 23 Jun 2017 12:38:10 -0400 Subject: [PATCH 03/11] Add in scope rebar version --- pkgs/development/beam-modules/default.nix | 24 +++++++++----------- pkgs/development/beam-modules/lib.nix | 27 +++++++++++++++++++---- 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/pkgs/development/beam-modules/default.nix b/pkgs/development/beam-modules/default.nix index d54520212a51..07cc2ebd94b7 100644 --- a/pkgs/development/beam-modules/default.nix +++ b/pkgs/development/beam-modules/default.nix @@ -39,21 +39,17 @@ let # BEAM-based languages. elixir = defaultScope.elixir-1_4; - elixir-1_4 = if versionAtLeast (lib.getVersion erlang) "18" - then - lib.callElixir ../interpreters/elixir/1.4.nix { - debugInfo = true; - erlang = erlang; - } - else throw "Elixir requires at least Erlang/OTP R18."; + elixir-1_4 = lib.callElixir ../interpreters/elixir/1.4.nix "18" { + debugInfo = true; + erlang = erlang; + rebar = defaultScope.rebar; + }; - elixir-1_3 = if versionAtLeast (lib.getVersion erlang) "18" - then - lib.callElixir ../interpreters/elixir/1.3.nix { - debugInfo = true; - erlang = erlang; - } - else throw "Elixir requires at least Erlang/OTP R18."; + elixir-1_3 = lib.callElixir ../interpreters/elixir/1.3.nix "18" { + debugInfo = true; + erlang = erlang; + rebar = defaultScope.rebar; + }; lfe = callPackage ../interpreters/lfe { }; diff --git a/pkgs/development/beam-modules/lib.nix b/pkgs/development/beam-modules/lib.nix index 9d7a4bbd34ed..df0af4057637 100644 --- a/pkgs/development/beam-modules/lib.nix +++ b/pkgs/development/beam-modules/lib.nix @@ -43,12 +43,31 @@ rec { mkDerivation = pkgs.makeOverridable builder; }; - callElixir = drv: args: + /* Uses generic-builder to evaluate provided drv containing Elixir version + specific data. + + drv: package containing version-specific args; + vsn: minimum OTP version that Elixir will build on; + builder: generic builder for all Erlang versions; + args: arguments merged into version-specific args, used mostly to customize + dependencies; + + Arguments passed to the generic-builder are overridable. + + Please note that "mkDerivation" defined here is the one called from 1.4.nix + and similar files. + */ + callElixir = drv: vsn: args: let + inherit (stdenv.lib) versionAtLeast; builder = callPackage ../../development/interpreters/elixir/generic-builder.nix args; in - callPackage drv { - mkDerivation = pkgs.makeOverridable builder; - }; + if versionAtLeast (getVersion args.erlang) vsn + then + callPackage drv { + mkDerivation = pkgs.makeOverridable builder; + } + else + throw "Elixir requires at least Erlang/OTP R${vsn}."; } From aa1f059116b9e7685e9b905434148c202674f4df Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Sat, 24 Jun 2017 09:44:48 -0400 Subject: [PATCH 04/11] Remove defaultScope in favour of rec for elixir versions Also removed superfluous path segments from elixir generic builder --- pkgs/development/beam-modules/default.nix | 10 ++++------ pkgs/development/beam-modules/lib.nix | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/pkgs/development/beam-modules/default.nix b/pkgs/development/beam-modules/default.nix index 07cc2ebd94b7..69265aa53e4d 100644 --- a/pkgs/development/beam-modules/default.nix +++ b/pkgs/development/beam-modules/default.nix @@ -16,7 +16,7 @@ let in import ./hex-packages.nix { inherit pkgs stdenv callPackage; - } // { + } // rec { inherit callPackage erlang; beamPackages = self; @@ -37,18 +37,16 @@ let buildMix = callPackage ./build-mix.nix {}; # BEAM-based languages. - elixir = defaultScope.elixir-1_4; + elixir = elixir-1_4; elixir-1_4 = lib.callElixir ../interpreters/elixir/1.4.nix "18" { + inherit rebar erlang; debugInfo = true; - erlang = erlang; - rebar = defaultScope.rebar; }; elixir-1_3 = lib.callElixir ../interpreters/elixir/1.3.nix "18" { + inherit rebar erlang; debugInfo = true; - erlang = erlang; - rebar = defaultScope.rebar; }; lfe = callPackage ../interpreters/lfe { }; diff --git a/pkgs/development/beam-modules/lib.nix b/pkgs/development/beam-modules/lib.nix index df0af4057637..8a93282d1ec4 100644 --- a/pkgs/development/beam-modules/lib.nix +++ b/pkgs/development/beam-modules/lib.nix @@ -60,7 +60,7 @@ rec { callElixir = drv: vsn: args: let inherit (stdenv.lib) versionAtLeast; - builder = callPackage ../../development/interpreters/elixir/generic-builder.nix args; + builder = callPackage ../interpreters/elixir/generic-builder.nix args; in if versionAtLeast (getVersion args.erlang) vsn then From 909da3998e9c59c17d17f31a9713b9894a6f8374 Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Mon, 26 Jun 2017 12:42:56 -0400 Subject: [PATCH 05/11] Include Elixir 1.5 rc --- pkgs/development/beam-modules/default.nix | 5 +++++ pkgs/development/interpreters/elixir/1.5.nix | 6 ++++++ pkgs/top-level/beam-packages.nix | 1 + 3 files changed, 12 insertions(+) create mode 100644 pkgs/development/interpreters/elixir/1.5.nix diff --git a/pkgs/development/beam-modules/default.nix b/pkgs/development/beam-modules/default.nix index 69265aa53e4d..d1907e07262d 100644 --- a/pkgs/development/beam-modules/default.nix +++ b/pkgs/development/beam-modules/default.nix @@ -39,6 +39,11 @@ let # BEAM-based languages. elixir = elixir-1_4; + elixir-1_5 = lib.callElixir ../interpreters/elixir/1.5.nix "18" { + inherit rebar erlang; + debugInfo = true; + }; + elixir-1_4 = lib.callElixir ../interpreters/elixir/1.4.nix "18" { inherit rebar erlang; debugInfo = true; diff --git a/pkgs/development/interpreters/elixir/1.5.nix b/pkgs/development/interpreters/elixir/1.5.nix new file mode 100644 index 000000000000..4ef30204ce31 --- /dev/null +++ b/pkgs/development/interpreters/elixir/1.5.nix @@ -0,0 +1,6 @@ +{ mkDerivation }: + +mkDerivation rec { + version = "1.5.0-rc.0"; + sha256 = "1p0sawz86w9na56c42ivdacqxzldjb9s9cvl2isj3sy4nwsa0l0j"; +} diff --git a/pkgs/top-level/beam-packages.nix b/pkgs/top-level/beam-packages.nix index 877feaee8710..3a2d91617838 100644 --- a/pkgs/top-level/beam-packages.nix +++ b/pkgs/top-level/beam-packages.nix @@ -57,6 +57,7 @@ rec { # access for example elixir built with different version of Erlang, use # `beam.packages.erlangR19.elixir`. elixir = packages.erlang.elixir; + elixir-1_5 = packages.erlang.elixir-1_5; elixir-1_4 = packages.erlang.elixir-1_4; elixir-1_3 = packages.erlang.elixir-1_3; From 803797c6d6983ea2652247b8335aa1f96744d323 Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Mon, 26 Jun 2017 16:58:44 -0400 Subject: [PATCH 06/11] Inherit the elixir versions for beam modules Rename attributes from elixir-1_x to elixir_1_x --- pkgs/development/beam-modules/default.nix | 8 ++++---- pkgs/top-level/beam-packages.nix | 5 +---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/pkgs/development/beam-modules/default.nix b/pkgs/development/beam-modules/default.nix index d1907e07262d..ffafe88cc7f8 100644 --- a/pkgs/development/beam-modules/default.nix +++ b/pkgs/development/beam-modules/default.nix @@ -37,19 +37,19 @@ let buildMix = callPackage ./build-mix.nix {}; # BEAM-based languages. - elixir = elixir-1_4; + elixir = elixir_1_4; - elixir-1_5 = lib.callElixir ../interpreters/elixir/1.5.nix "18" { + elixir_1_5_rc = lib.callElixir ../interpreters/elixir/1.5.nix "18" { inherit rebar erlang; debugInfo = true; }; - elixir-1_4 = lib.callElixir ../interpreters/elixir/1.4.nix "18" { + elixir_1_4 = lib.callElixir ../interpreters/elixir/1.4.nix "18" { inherit rebar erlang; debugInfo = true; }; - elixir-1_3 = lib.callElixir ../interpreters/elixir/1.3.nix "18" { + elixir_1_3 = lib.callElixir ../interpreters/elixir/1.3.nix "18" { inherit rebar erlang; debugInfo = true; }; diff --git a/pkgs/top-level/beam-packages.nix b/pkgs/top-level/beam-packages.nix index 3a2d91617838..8d01ad36139d 100644 --- a/pkgs/top-level/beam-packages.nix +++ b/pkgs/top-level/beam-packages.nix @@ -56,10 +56,7 @@ rec { # Other Beam languages. These are built with `beam.interpreters.erlang`. To # access for example elixir built with different version of Erlang, use # `beam.packages.erlangR19.elixir`. - elixir = packages.erlang.elixir; - elixir-1_5 = packages.erlang.elixir-1_5; - elixir-1_4 = packages.erlang.elixir-1_4; - elixir-1_3 = packages.erlang.elixir-1_3; + inherit (packages.erlang) elixir elixir_1_5_rc elixir_1_4 elixir_1_3; lfe = packages.erlang.lfe; }; From 46faaa69b86ba0ef9d416358de0ab3929985a6b4 Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Mon, 26 Jun 2017 23:09:11 -0400 Subject: [PATCH 07/11] Make assertion for OTP version in the generic elixir builder Changed Elixir 1.5 to include the fact it is an rc release --- pkgs/development/beam-modules/lib.nix | 10 +- pkgs/development/interpreters/elixir/1.3.nix | 1 + pkgs/development/interpreters/elixir/1.4.nix | 1 + pkgs/development/interpreters/elixir/1.5.nix | 1 + .../interpreters/elixir/generic-builder.nix | 107 ++++++++++-------- 5 files changed, 63 insertions(+), 57 deletions(-) diff --git a/pkgs/development/beam-modules/lib.nix b/pkgs/development/beam-modules/lib.nix index 8a93282d1ec4..43c1a3e45d52 100644 --- a/pkgs/development/beam-modules/lib.nix +++ b/pkgs/development/beam-modules/lib.nix @@ -62,12 +62,8 @@ rec { inherit (stdenv.lib) versionAtLeast; builder = callPackage ../interpreters/elixir/generic-builder.nix args; in - if versionAtLeast (getVersion args.erlang) vsn - then - callPackage drv { - mkDerivation = pkgs.makeOverridable builder; - } - else - throw "Elixir requires at least Erlang/OTP R${vsn}."; + callPackage drv { + mkDerivation = pkgs.makeOverridable builder; + }; } diff --git a/pkgs/development/interpreters/elixir/1.3.nix b/pkgs/development/interpreters/elixir/1.3.nix index 90d81ee0120b..43d48e2cf7cd 100644 --- a/pkgs/development/interpreters/elixir/1.3.nix +++ b/pkgs/development/interpreters/elixir/1.3.nix @@ -3,4 +3,5 @@ mkDerivation rec { version = "1.3.4"; sha256 = "01qqv1ghvfadcwcr5p88w8j217cgaf094pmpqllij3l0q1yg104l"; + minimumOTPVersion = "18"; } diff --git a/pkgs/development/interpreters/elixir/1.4.nix b/pkgs/development/interpreters/elixir/1.4.nix index 2729c9942208..9ddd9062acd9 100644 --- a/pkgs/development/interpreters/elixir/1.4.nix +++ b/pkgs/development/interpreters/elixir/1.4.nix @@ -3,4 +3,5 @@ mkDerivation rec { version = "1.4.5"; sha256 = "18ivcxmh5bak13k3rjy7jjzin57rgb2nffhwnqb2wl7bpi8mrarw"; + minimumOTPVersion = "18"; } diff --git a/pkgs/development/interpreters/elixir/1.5.nix b/pkgs/development/interpreters/elixir/1.5.nix index 4ef30204ce31..d9e2e9c16c62 100644 --- a/pkgs/development/interpreters/elixir/1.5.nix +++ b/pkgs/development/interpreters/elixir/1.5.nix @@ -3,4 +3,5 @@ mkDerivation rec { version = "1.5.0-rc.0"; sha256 = "1p0sawz86w9na56c42ivdacqxzldjb9s9cvl2isj3sy4nwsa0l0j"; + minimumOTPVersion = "18"; } diff --git a/pkgs/development/interpreters/elixir/generic-builder.nix b/pkgs/development/interpreters/elixir/generic-builder.nix index 60f044e16d0f..a3f60a7f22e4 100644 --- a/pkgs/development/interpreters/elixir/generic-builder.nix +++ b/pkgs/development/interpreters/elixir/generic-builder.nix @@ -1,70 +1,77 @@ -{ pkgs, stdenv, fetchFromGitHub, erlang, rebar, makeWrapper, coreutils, curl -, bash, debugInfo ? false }: +{ pkgs, stdenv, fetchFromGitHub, erlang, rebar, makeWrapper, + coreutils, curl, bash, debugInfo ? false }: { baseName ? "elixir" , version +, minimumOTPVersion , sha256 ? null , rev ? "v${version}" , src ? fetchFromGitHub { inherit rev sha256; owner = "elixir-lang"; repo = "elixir"; } }: -stdenv.mkDerivation ({ - name = "${baseName}-${version}"; +let + inherit (stdenv.lib) getVersion versionAtLeast; - inherit src version; +in + assert versionAtLeast (getVersion erlang) minimumOTPVersion; - buildInputs = [ erlang rebar makeWrapper ]; + stdenv.mkDerivation ({ + name = "${baseName}-${version}"; - LANG = "en_US.UTF-8"; - LC_TYPE = "en_US.UTF-8"; + inherit src version; - setupHook = ./setup-hook.sh; + buildInputs = [ erlang rebar makeWrapper ]; - inherit debugInfo; + LANG = "en_US.UTF-8"; + LC_TYPE = "en_US.UTF-8"; - buildFlags = if debugInfo - then "ERL_COMPILER_OPTIONS=debug_info" - else ""; + setupHook = ./setup-hook.sh; - preBuild = '' - # The build process uses ./rebar. Link it to the nixpkgs rebar - rm -v rebar - ln -s ${rebar}/bin/rebar rebar + inherit debugInfo; - substituteInPlace Makefile \ - --replace "/usr/local" $out - ''; + buildFlags = if debugInfo + then "ERL_COMPILER_OPTIONS=debug_info" + else ""; - postFixup = '' - # Elixir binaries are shell scripts which run erl. Add some stuff - # to PATH so the scripts can run without problems. + preBuild = '' + # The build process uses ./rebar. Link it to the nixpkgs rebar + rm -v rebar + ln -s ${rebar}/bin/rebar rebar - for f in $out/bin/*; do - b=$(basename $f) - if [ $b == "mix" ]; then continue; fi - wrapProgram $f \ - --prefix PATH ":" "${stdenv.lib.makeBinPath [ erlang coreutils curl bash ]}" \ - --set CURL_CA_BUNDLE /etc/ssl/certs/ca-certificates.crt - done - - substituteInPlace $out/bin/mix \ - --replace "/usr/bin/env elixir" "${coreutils}/bin/env elixir" - ''; - - meta = with stdenv.lib; { - homepage = "http://elixir-lang.org/"; - description = "A functional, meta-programming aware language built on top of the Erlang VM"; - - longDescription = '' - Elixir is a functional, meta-programming aware language built on - top of the Erlang VM. It is a dynamic language with flexible - syntax and macro support that leverages Erlang's abilities to - build concurrent, distributed and fault-tolerant applications - with hot code upgrades. + substituteInPlace Makefile \ + --replace "/usr/local" $out ''; - license = licenses.epl10; - platforms = platforms.unix; - maintainers = with maintainers; [ the-kenny havvy couchemar ankhers ]; - }; -}) + postFixup = '' + # Elixir binaries are shell scripts which run erl. Add some stuff + # to PATH so the scripts can run without problems. + + for f in $out/bin/*; do + b=$(basename $f) + if [ $b == "mix" ]; then continue; fi + wrapProgram $f \ + --prefix PATH ":" "${stdenv.lib.makeBinPath [ erlang coreutils curl bash ]}" \ + --set CURL_CA_BUNDLE /etc/ssl/certs/ca-certificates.crt + done + + substituteInPlace $out/bin/mix \ + --replace "/usr/bin/env elixir" "${coreutils}/bin/env elixir" + ''; + + meta = with stdenv.lib; { + homepage = "http://elixir-lang.org/"; + description = "A functional, meta-programming aware language built on top of the Erlang VM"; + + longDescription = '' + Elixir is a functional, meta-programming aware language built on + top of the Erlang VM. It is a dynamic language with flexible + syntax and macro support that leverages Erlang's abilities to + build concurrent, distributed and fault-tolerant applications + with hot code upgrades. + ''; + + license = licenses.epl10; + platforms = platforms.unix; + maintainers = with maintainers; [ the-kenny havvy couchemar ankhers ]; + }; + }) From dc2f1569b30a61f43a2870867910ee21c8d8d5b2 Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Mon, 26 Jun 2017 23:10:13 -0400 Subject: [PATCH 08/11] Add the new elixir versions to the top level --- pkgs/top-level/all-packages.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d80777adc54f..c3c1be513ba4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5990,8 +5990,14 @@ with pkgs; inherit (beam.interpreters) erlang erlang_odbc erlang_javac erlang_odbc_javac - erlangR17 erlangR18 erlangR19 erlangR20 - erlang_basho_R16B02 elixir lfe; + elixir elixir_1_5_rc elixir_1_4 elixir_1_3 + lfe + erlangR16 erlangR16_odbc + erlang_basho_R16B02 erlang_basho_R16B02_odbc + erlangR17 erlangR17_odbc erlangR17_javac erlangR17_odbc_javac + erlangR18 erlangR18_odbc erlangR18_javac erlangR18_odbc_javac + erlangR19 erlangR19_odbc erlangR19_javac erlangR19_odbc_javac + erlangR20 erlangR20_odbc erlangR20_javac erlangR20_odbc_javac; inherit (beam.packages.erlang) rebar rebar3-open rebar3 From cc09faa6fb3052da94066a3f95d317f5c720e054 Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Mon, 26 Jun 2017 23:12:39 -0400 Subject: [PATCH 09/11] Remove additional OTP version information --- pkgs/development/beam-modules/default.nix | 6 +++--- pkgs/development/beam-modules/lib.nix | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pkgs/development/beam-modules/default.nix b/pkgs/development/beam-modules/default.nix index ffafe88cc7f8..f0a049bb4b23 100644 --- a/pkgs/development/beam-modules/default.nix +++ b/pkgs/development/beam-modules/default.nix @@ -39,17 +39,17 @@ let # BEAM-based languages. elixir = elixir_1_4; - elixir_1_5_rc = lib.callElixir ../interpreters/elixir/1.5.nix "18" { + elixir_1_5_rc = lib.callElixir ../interpreters/elixir/1.5.nix { inherit rebar erlang; debugInfo = true; }; - elixir_1_4 = lib.callElixir ../interpreters/elixir/1.4.nix "18" { + elixir_1_4 = lib.callElixir ../interpreters/elixir/1.4.nix { inherit rebar erlang; debugInfo = true; }; - elixir_1_3 = lib.callElixir ../interpreters/elixir/1.3.nix "18" { + elixir_1_3 = lib.callElixir ../interpreters/elixir/1.3.nix { inherit rebar erlang; debugInfo = true; }; diff --git a/pkgs/development/beam-modules/lib.nix b/pkgs/development/beam-modules/lib.nix index 43c1a3e45d52..da21cc17bf2f 100644 --- a/pkgs/development/beam-modules/lib.nix +++ b/pkgs/development/beam-modules/lib.nix @@ -47,7 +47,6 @@ rec { specific data. drv: package containing version-specific args; - vsn: minimum OTP version that Elixir will build on; builder: generic builder for all Erlang versions; args: arguments merged into version-specific args, used mostly to customize dependencies; @@ -57,7 +56,7 @@ rec { Please note that "mkDerivation" defined here is the one called from 1.4.nix and similar files. */ - callElixir = drv: vsn: args: + callElixir = drv: args: let inherit (stdenv.lib) versionAtLeast; builder = callPackage ../interpreters/elixir/generic-builder.nix args; From a19f9668f219a47e2c819797c952950486bbba86 Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Tue, 27 Jun 2017 14:03:14 -0400 Subject: [PATCH 10/11] Remove Erlang specific version retrieval --- pkgs/development/beam-modules/lib.nix | 9 --------- 1 file changed, 9 deletions(-) diff --git a/pkgs/development/beam-modules/lib.nix b/pkgs/development/beam-modules/lib.nix index da21cc17bf2f..dd4ed5e1bbf8 100644 --- a/pkgs/development/beam-modules/lib.nix +++ b/pkgs/development/beam-modules/lib.nix @@ -12,15 +12,6 @@ rec { callPackage = callPackageWith pkgs; - /* Erlang/OTP-specific version retrieval, returns 19 for OTP R19 */ - getVersion = x: - let - parse = drv: (builtins.parseDrvName drv).version; - in builtins.replaceStrings ["B" "-"] ["." "."] ( - if builtins.isString x - then parse x - else x.version or (parse x.name)); - /* Uses generic-builder to evaluate provided drv containing OTP-version specific data. From 6db77ccef456fd2d7426fa77390f2c05ac412143 Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Sat, 8 Jul 2017 20:32:16 -0400 Subject: [PATCH 11/11] Fix quoting in Elixir generic builder --- pkgs/development/interpreters/elixir/generic-builder.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/interpreters/elixir/generic-builder.nix b/pkgs/development/interpreters/elixir/generic-builder.nix index a3f60a7f22e4..ff63406aea36 100644 --- a/pkgs/development/interpreters/elixir/generic-builder.nix +++ b/pkgs/development/interpreters/elixir/generic-builder.nix @@ -48,7 +48,7 @@ in for f in $out/bin/*; do b=$(basename $f) - if [ $b == "mix" ]; then continue; fi + if [ "$b" = mix ]; then continue; fi wrapProgram $f \ --prefix PATH ":" "${stdenv.lib.makeBinPath [ erlang coreutils curl bash ]}" \ --set CURL_CA_BUNDLE /etc/ssl/certs/ca-certificates.crt