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:
parent
033902d269
commit
4ba1a51b7f
|
@ -22,21 +22,17 @@ stdenv.mkDerivation (attrs // {
|
||||||
inherit sha256;
|
inherit sha256;
|
||||||
};
|
};
|
||||||
|
|
||||||
postPatch = let
|
postPatch = ''
|
||||||
registrySnapshot = import ./registrySnapshot.nix { inherit fetchFromGitHub; };
|
|
||||||
in ''
|
|
||||||
rm -f rebar rebar3
|
rm -f rebar rebar3
|
||||||
if [ -e "src/${name}.app.src" ]; then
|
if [ -e "src/${name}.app.src" ]; then
|
||||||
sed -i -e 's/{ *vsn *,[^}]*}/{vsn, "${version}"}/' "src/${name}.app.src"
|
sed -i -e 's/{ *vsn *,[^}]*}/{vsn, "${version}"}/' "src/${name}.app.src"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TODO: figure out how to provide 'pc' plugin hermetically
|
|
||||||
${if compilePorts then ''
|
${if compilePorts then ''
|
||||||
echo "{plugins, [pc]}." >> rebar.config
|
echo "{plugins, [pc]}." >> rebar.config
|
||||||
'' else ''''}
|
'' else ''''}
|
||||||
|
|
||||||
mkdir -p _build/default/{lib,plugins}/ ./.cache/rebar3/hex/default/
|
${rebar3.setupRegistry}
|
||||||
zcat ${registrySnapshot}/registry.ets.gz > .cache/rebar3/hex/default/registry
|
|
||||||
|
|
||||||
${postPatch}
|
${postPatch}
|
||||||
'';
|
'';
|
||||||
|
@ -61,8 +57,6 @@ stdenv.mkDerivation (attrs // {
|
||||||
runHook postConfigure
|
runHook postConfigure
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# TODO: figure out how to provide rebar3 a static registry snapshot to make
|
|
||||||
# this hermetic
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
runHook preBuild
|
runHook preBuild
|
||||||
HOME=. rebar3 compile
|
HOME=. rebar3 compile
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
{ stdenv, fetchurl, erlang }:
|
{ stdenv, fetchurl, erlang, tree, fetchFromGitHub }:
|
||||||
|
|
||||||
|
|
||||||
let
|
let
|
||||||
version = "3.0.0-beta.4";
|
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
|
in
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "rebar3-${version}";
|
name = "rebar3-${version}";
|
||||||
|
@ -13,8 +18,11 @@ stdenv.mkDerivation {
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [ erlang ];
|
buildInputs = [ erlang ];
|
||||||
|
inherit setupRegistry;
|
||||||
|
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
|
${setupRegistry}
|
||||||
HOME=. escript bootstrap
|
HOME=. escript bootstrap
|
||||||
'';
|
'';
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
|
Loading…
Reference in New Issue