Automagically download files from hex.pm tarball S3 repo

This commit is contained in:
Gleb Peregud 2015-12-10 21:21:05 +01:00
parent a05e2dbe65
commit 6dcbe059e1
3 changed files with 9 additions and 23 deletions

@ -1,6 +1,6 @@
{ stdenv, erlang, rebar3, openssl, libyaml }:
{ stdenv, erlang, rebar3, openssl, libyaml, fetchurl }:
{ name, version
{ name, version, sha256
, buildInputs ? [], erlangDeps ? []
, postPatch ? ""
, ... }@attrs:
@ -20,12 +20,10 @@ stdenv.mkDerivation (attrs // {
${postPatch}
'';
# unpackCmd = "(mkdir cron && cd cron && sh $curSrc)";
unpackCmd = ''
tar -xf $curSrc contents.tar.gz
mkdir contents
tar -C contents -xzf contents.tar.gz
# rm -rf CHECKSUM contents.tar.gz metadata.config VERSION
'';
configurePhase = let
@ -41,9 +39,6 @@ stdenv.mkDerivation (attrs // {
ln -s "${dep}" "_build/default/lib/${dep.packageName}"
stopNest
'') recursiveDeps}
ls -laR
cat rebar.config || true
cat rebar.lock || true
runHook postConfigure
'';
@ -55,7 +50,6 @@ stdenv.mkDerivation (attrs // {
'';
installPhase = ''
ls -laR
runHook preInstall
mkdir "$out"
for reldir in src ebin priv include; do
@ -67,10 +61,10 @@ stdenv.mkDerivation (attrs // {
runHook postInstall
'';
# src = fetchurl {
# url = "https://s3.amazonaws.com/s3.hex.pm/tarballs/${name}-${version}.tar";
# sha256 = "1zjgbarclhh10cpgvfxikn9p2ay63rajq96q1sbz9r9w6v6p8jm9";
# };
src = fetchurl {
url = "https://s3.amazonaws.com/s3.hex.pm/tarballs/${name}-${version}.tar";
sha256 = sha256;
};
passthru = {
packageName = name;

@ -3,9 +3,5 @@
buildHex {
name = "goldrush";
version = "0.1.7";
src = fetchurl {
url = "https://s3.amazonaws.com/s3.hex.pm/tarballs/goldrush-0.1.7.tar";
sha256 = "1zjgbarclhh10cpgvfxikn9p2ay63rajq96q1sbz9r9w6v6p8jm9";
};
sha256 = "1zjgbarclhh10cpgvfxikn9p2ay63rajq96q1sbz9r9w6v6p8jm9";
}

@ -1,12 +1,8 @@
{ buildHex, fetchurl, goldrush }:
{ buildHex, goldrush }:
buildHex {
name = "lager";
version = "3.0.2";
src = fetchurl {
url = "https://s3.amazonaws.com/s3.hex.pm/tarballs/lager-3.0.2.tar";
sha256 = "0051zj6wfmmvxjn9q0nw8wic13nhbrkyy50cg1lcpdh17qiknzsj";
};
sha256 = "0051zj6wfmmvxjn9q0nw8wic13nhbrkyy50cg1lcpdh17qiknzsj";
erlangDeps = [ goldrush ];
}