Move registry to rebar3, since it needs it itself to be bootstrapped.

This makes rebar3 build a bit more hermetic. Next stage is to pull in
rebar3 plugins dependencies for bootstrap to pick up.
This commit is contained in:
Gleb Peregud 2015-12-13 14:06:35 +01:00
parent 033902d269
commit 4ba1a51b7f
3 changed files with 11 additions and 9 deletions

View File

@ -22,21 +22,17 @@ stdenv.mkDerivation (attrs // {
inherit sha256;
};
postPatch = let
registrySnapshot = import ./registrySnapshot.nix { inherit fetchFromGitHub; };
in ''
postPatch = ''
rm -f rebar rebar3
if [ -e "src/${name}.app.src" ]; then
sed -i -e 's/{ *vsn *,[^}]*}/{vsn, "${version}"}/' "src/${name}.app.src"
fi
# TODO: figure out how to provide 'pc' plugin hermetically
${if compilePorts then ''
echo "{plugins, [pc]}." >> rebar.config
'' else ''''}
mkdir -p _build/default/{lib,plugins}/ ./.cache/rebar3/hex/default/
zcat ${registrySnapshot}/registry.ets.gz > .cache/rebar3/hex/default/registry
${rebar3.setupRegistry}
${postPatch}
'';
@ -61,8 +57,6 @@ stdenv.mkDerivation (attrs // {
runHook postConfigure
'';
# TODO: figure out how to provide rebar3 a static registry snapshot to make
# this hermetic
buildPhase = ''
runHook preBuild
HOME=. rebar3 compile

View File

@ -1,8 +1,13 @@
{ stdenv, fetchurl, erlang }:
{ stdenv, fetchurl, erlang, tree, fetchFromGitHub }:
let
version = "3.0.0-beta.4";
registrySnapshot = import ./registrySnapshot.nix { inherit fetchFromGitHub; };
setupRegistry = ''
mkdir -p _build/default/{lib,plugins,packages}/ ./.cache/rebar3/hex/default/
zcat ${registrySnapshot}/registry.ets.gz > .cache/rebar3/hex/default/registry
'';
in
stdenv.mkDerivation {
name = "rebar3-${version}";
@ -13,8 +18,11 @@ stdenv.mkDerivation {
};
buildInputs = [ erlang ];
inherit setupRegistry;
buildPhase = ''
${setupRegistry}
HOME=. escript bootstrap
'';
installPhase = ''