diff options
author | Gleb Peregud <gleber.p@gmail.com> | 2015-12-11 00:00:33 +0100 |
---|---|---|
committer | Gleb Peregud <gleber.p@gmail.com> | 2015-12-15 14:01:37 +0100 |
commit | 5d3680d26516b35a04cd02b6e95122c46bd243a5 (patch) | |
tree | 622a0f2837fa2d1440f4285976ff6063430fd6ef | |
parent | 3a9110b15ccd0ab33e07147f443a63ac567a7681 (diff) | |
download | nixlib-5d3680d26516b35a04cd02b6e95122c46bd243a5.tar nixlib-5d3680d26516b35a04cd02b6e95122c46bd243a5.tar.gz nixlib-5d3680d26516b35a04cd02b6e95122c46bd243a5.tar.bz2 nixlib-5d3680d26516b35a04cd02b6e95122c46bd243a5.tar.lz nixlib-5d3680d26516b35a04cd02b6e95122c46bd243a5.tar.xz nixlib-5d3680d26516b35a04cd02b6e95122c46bd243a5.tar.zst nixlib-5d3680d26516b35a04cd02b6e95122c46bd243a5.zip |
Fetch hex.pm registry snapshot with external github repo.
This allows to avoid fetching registry file from S3 at build time, making the build hermetic and much faster. Automatic tools will be used to update said external repo content when Hex packages are imported/update.
-rw-r--r-- | pkgs/development/erlang-modules/build-hex.nix | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/pkgs/development/erlang-modules/build-hex.nix b/pkgs/development/erlang-modules/build-hex.nix index e664d357d851..efeda1c6373c 100644 --- a/pkgs/development/erlang-modules/build-hex.nix +++ b/pkgs/development/erlang-modules/build-hex.nix @@ -1,4 +1,4 @@ -{ stdenv, erlang, rebar3, openssl, libyaml, fetchurl }: +{ stdenv, erlang, rebar3, openssl, libyaml, fetchurl, fetchFromGitHub }: { name, version, sha256 , hexPkg ? name @@ -14,7 +14,14 @@ stdenv.mkDerivation (attrs // { buildInputs = buildInputs ++ [ erlang rebar3 openssl libyaml ]; - postPatch = '' + postPatch = let + registrySnapshot = fetchFromGitHub { + owner = "gleber"; + repo = "hex-pm-registry-snapshots"; + rev = "48147b0"; + sha256 = "0ibfnhrhbka4n6wkhs99fpy3sjab54ip37jgvx2hcfhfr4pxhbxw"; + }; + in '' rm -f rebar rebar3 if [ -e "src/${name}.app.src" ]; then sed -i -e 's/{ *vsn *,[^}]*}/{vsn, "${version}"}/' "src/${name}.app.src" @@ -25,6 +32,9 @@ stdenv.mkDerivation (attrs // { 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 + ${postPatch} ''; @@ -44,7 +54,6 @@ stdenv.mkDerivation (attrs // { }; in '' runHook preConfigure - mkdir -p _build/default/{lib,plugins}/ ${concatMapStrings (dep: '' header "linking erlang dependency ${dep}" ln -s "${dep}" "_build/default/lib/${dep.packageName}" @@ -62,7 +71,7 @@ stdenv.mkDerivation (attrs // { # this hermetic buildPhase = '' runHook preBuild - HOME=. rebar3 do update, compile + HOME=. rebar3 compile ${if compilePorts then '' HOME=. rebar3 pc compile '' else ''''} |