Skip to content

Commit

Permalink
Merge pull request #29227 from gleber/beam-tooling-upgrade
Browse files Browse the repository at this point in the history
beam: tooling upgrade (rebar3, hex2nix, relx, etc)
  • Loading branch information
Mic92 committed Sep 12, 2017
2 parents a101328 + c041770 commit b1140f9
Show file tree
Hide file tree
Showing 12 changed files with 207 additions and 291 deletions.
9 changes: 9 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,12 @@ pkgs/development/r-modules @peti
pkgs/stdenv/darwin/* @copumpkin @LnL7
pkgs/os-specific/darwin/* @LnL7
pkgs/os-specific/darwin/apple-source-releases/* @copumpkin

# Beam-related (Erlang, Elixir, LFE, etc)
pkgs/development/beam-modules/* @gleber
pkgs/development/interpreters/erlang/* @gleber
pkgs/development/interpreters/lfe/* @gleber
pkgs/development/interpreters/elixir/* @gleber
pkgs/development/tools/build-managers/rebar/* @gleber
pkgs/development/tools/build-managers/rebar3/* @gleber
pkgs/development/tools/erlang/* @gleber
34 changes: 31 additions & 3 deletions pkgs/development/beam-modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ let
inherit callPackage erlang;
beamPackages = self;

hexRegistrySnapshot = callPackage ./hex-registry-snapshot.nix { };

rebar = callPackage ../tools/build-managers/rebar { };
rebar3-open = callPackage ../tools/build-managers/rebar3 {
hermeticRebar3 = false;
Expand All @@ -28,7 +30,10 @@ let
hermeticRebar3 = true;
};

hexRegistrySnapshot = callPackage ./hex-registry-snapshot.nix { };
# rebar3 port compiler plugin is required by buildRebar3
pc_1_6_0 = callPackage ./pc {};
pc = pc_1_6_0;

fetchHex = callPackage ./fetch-hex.nix { };

buildRebar3 = callPackage ./build-rebar3.nix {};
Expand Down Expand Up @@ -57,12 +62,35 @@ let
lfe = lfe_1_2;
lfe_1_2 = lib.callLFE ../interpreters/lfe/1.2.nix { inherit erlang buildRebar3 buildHex; };

# Non hex packages
# We list all base hex packages for beam tooling explicitly to ensure
# tha the tooling does not break during hex-packages.nix updates.
erlware_commons_1_0_0 = buildHex {
name = "erlware_commons";
version = "1.0.0";
sha256 = "0wkphbrjk19lxdwndy92v058qwcaz13bcgdzp33h21aa7vminzx7";
beamDeps = [ cf_0_2_2 ];
};
cf_0_2_2 = buildHex {
name = "cf";
version = "0.2.2";
sha256 = "08cvy7skn5d2k4manlx5k3anqgjdvajjhc5jwxbaszxw34q3na28";
};
getopt_0_8_2 = buildHex {
name = "getopt";
version = "0.8.2";
sha256 = "1xw30h59zbw957cyjd8n50hf9y09jnv9dyry6x3avfwzcyrnsvkk";
};

# Non hex packages. Examples how to build Rebar/Mix packages with and
# without helper functions buildRebar3 and buildMix.
hex = callPackage ./hex {};
webdriver = callPackage ./webdriver {};
relxExe = callPackage ../tools/erlang/relx-exe {};

# The tool used to upgrade hex-packages.nix.
hex2nix = callPackage ../tools/erlang/hex2nix {};

# An example of Erlang/C++ package.
cuter = callPackage ../tools/erlang/cuter {};
relxExe = callPackage ../tools/erlang/relx-exe {};
};
in makeExtensible packages
5 changes: 3 additions & 2 deletions pkgs/development/beam-modules/hex-registry-snapshot.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

stdenv.mkDerivation rec {
name = "hex-registry";
rev = "e5e494a";
rev = "9f736e7";
version = "0.0.0+build.${rev}";

# src = /home/gleber/code/erl/hex-pm-registry-snapshots;
src = fetchFromGitHub {
owner = "erlang-nix";
repo = "hex-pm-registry-snapshots";
inherit rev;
sha256 = "0877dragfxs22a05d8mv42z5535kfx9rs4y7fwwbd1ybphczf8za";
sha256 = "1xiw5yifyk3bbmr0cr82y1nc4c6zk11f6azdv07glb7yrgccrv79";
};

installPhase = ''
Expand Down
9 changes: 4 additions & 5 deletions pkgs/development/beam-modules/hex/default.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{stdenv, fetchFromGitHub, writeText, elixir }:
{ stdenv, fetchFromGitHub, writeText, elixir }:

let
shell = drv: stdenv.mkDerivation {
name = "interactive-shell-${drv.name}";
buildInputs = [ drv ];
};
name = "interactive-shell-${drv.name}";
buildInputs = [ drv ];
};

pkg = self: stdenv.mkDerivation rec {
name = "hex";
Expand Down Expand Up @@ -53,6 +53,5 @@ let
passthru = {
env = shell self;
};

};
in stdenv.lib.fix pkg
13 changes: 13 additions & 0 deletions pkgs/development/beam-modules/pc/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{ stdenv, buildHex }:

buildHex {
name = "pc";
version = "1.6.0";
sha256 = "0xq411ig5ny3iilkkkqa4vm3w3dgjc9cfzkqwk8pm13dw9mcm8h0";

meta = {
description = ''a rebar3 port compiler for native code'';
license = stdenv.lib.licenses.mit;
homepage = "https://github.com/blt/port_compiler";
};
}
6 changes: 3 additions & 3 deletions pkgs/development/beam-modules/webdriver/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

let
shell = drv: stdenv.mkDerivation {
name = "interactive-shell-${drv.name}";
buildInputs = [ drv ];
};
name = "interactive-shell-${drv.name}";
buildInputs = [ drv ];
};

pkg = self: stdenv.mkDerivation rec {
name = "webdriver";
Expand Down
78 changes: 38 additions & 40 deletions pkgs/development/tools/build-managers/rebar3/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,64 +3,64 @@
tree, fetchFromGitHub, hexRegistrySnapshot }:

let
version = "3.3.2";
version = "3.4.3";

bootstrapper = ./rebar3-nix-bootstrap;

erlware_commons = fetchHex {
pkg = "erlware_commons";
version = "1.0.0";
sha256 = "0wkphbrjk19lxdwndy92v058qwcaz13bcgdzp33h21aa7vminzx7";
};
ssl_verify_fun = fetchHex {
pkg = "ssl_verify_fun";
version = "1.1.2";
sha256 = "0qdyx70v09fydv4wzz1djnkixqj62ny40yjjhv2q6mh47lns2arj";
};
certifi = fetchHex {
pkg = "certifi";
version = "2.0.0";
sha256 = "075v7cvny52jbhnskchd3fp68fxgp7qfvdls0haamcycxrn0dipx";
};
providers = fetchHex {
pkg = "providers";
version = "1.6.0";
sha256 = "0byfa1h57n46jilz4q132j0vk3iqc0v1vip89li38gb1k997cs0g";
};
getopt = fetchHex {
pkg = "getopt";
version = "0.8.2";
sha256 = "1xw30h59zbw957cyjd8n50hf9y09jnv9dyry6x3avfwzcyrnsvkk";
};
bbmustache = fetchHex {
pkg = "bbmustache";
version = "1.3.0";
sha256 = "042pfgss8kscq6ssg8gix8ccmdsrx0anjczsbrn2a6c36ljrx2p6";
};
certifi = fetchHex {
pkg = "certifi";
version = "0.4.0";
sha256 = "04bnvsbssdcf6b9h9bfglflds7j0gx6q5igl1xxhx6fnwaz37hhw";
relx = fetchHex {
pkg = "relx";
version = "3.23.1";
sha256 = "13j7wds2d7b8v3r9pwy3zhwhzywgwhn6l9gm3slqzyrs1jld0a9d";
};
cf = fetchHex {
pkg = "cf";
version = "0.2.1";
sha256 = "19d0yvg8wwa57cqhn3vqfvw978nafw8j2rvb92s3ryidxjkrmvms";
version = "0.2.2";
sha256 = "08cvy7skn5d2k4manlx5k3anqgjdvajjhc5jwxbaszxw34q3na28";
};
cth_readable = fetchHex {
pkg = "cth_readable";
version = "1.2.3";
sha256 = "0wfpfismzi2q0nzvx9qyllch4skwmsk6yqffw8iw2v48ssbfvfhz";
};
erlware_commons = fetchHex {
pkg = "erlware_commons";
version = "0.21.0";
sha256 = "0gxb011m637rca2g0vhm1q9krm3va50rz1py6zf8k92q4iv9a2p7";
version = "1.3.0";
sha256 = "1s7bqj6f2zpbyjmbfq2mm6vcz1jrxjr2nd0531wshsx6fnshqhvs";
};
eunit_formatters = fetchHex {
pkg = "eunit_formatters";
version = "0.3.1";
sha256 = "0cg9dasv60v09q3q4wja76pld0546mhmlpb0khagyylv890hg934";
};
getopt = fetchHex {
pkg = "getopt";
version = "0.8.2";
sha256 = "1xw30h59zbw957cyjd8n50hf9y09jnv9dyry6x3avfwzcyrnsvkk";
};
providers = fetchHex {
pkg = "providers";
version = "1.6.0";
sha256 = "0byfa1h57n46jilz4q132j0vk3iqc0v1vip89li38gb1k997cs0g";
};
ssl_verify_fun = fetchHex {
pkg = "ssl_verify_fun";
version = "1.1.1";
sha256 = "0pnnan9xf4r6pr34hi28zdyv501i39jwnrwk6pr9r4wabkmhb22g";
};
relx = fetchHex {
pkg = "relx";
version = "3.21.1";
sha256 = "00590aqy0rfzgsnzxqgwbmn90imxxqlzmnmapy6bq76vw2rynvb8";
};
rebar3_hex = fetchHex {
pkg = "rebar3_hex";
version = "1.12.0";
sha256 = "45467e93ae8d776c6038fdaeaffbc55d8f2f097f300a54dab9b81c6d1cf21f73";
version = "4.0.0";
sha256 = "0k0ykx1lz62r03dpbi2zxsvrxgnr5hj67yky0hjrls09ynk4682v";
};

in
Expand All @@ -70,22 +70,20 @@ stdenv.mkDerivation {

src = fetchurl {
url = "https://github.com/rebar/rebar3/archive/${version}.tar.gz";
sha256 = "14nhc1bmna3b4y9qmd0lzpi0jdaw92r7ljg7vlghn297awsjgg6c";
sha256 = "1a05gpxxc3mx5v33kzpb5xnq5vglmjl0q8hrcvpinjlazcwbg531";
};

inherit bootstrapper;

patches = if hermeticRebar3 == true
then [ ./hermetic-bootstrap.patch ./hermetic-rebar3.patch ]
then [ ./hermetic-rebar3.patch ]
else [];

buildInputs = [ erlang tree ];
propagatedBuildInputs = [ hexRegistrySnapshot ];

postPatch = ''
echo postPatch
${erlang}/bin/escript ${bootstrapper} registry-only
echo "$ERL_LIBS"
mkdir -p _build/default/lib/
mkdir -p _build/default/plugins
cp --no-preserve=mode -R ${erlware_commons} _build/default/lib/erlware_commons
Expand Down

0 comments on commit b1140f9

Please sign in to comment.