Add few erlang modules

This commit is contained in:
Gleb Peregud 2015-12-10 00:12:37 +01:00
parent bcc4ca029a
commit a05e2dbe65
9 changed files with 232 additions and 0 deletions

@ -0,0 +1,60 @@
{ stdenv, erlang, rebar, openssl, libyaml }:
{ name, version
, buildInputs ? [], erlangDeps ? []
, postPatch ? ""
, ... }@attrs:
with stdenv.lib;
stdenv.mkDerivation (attrs // {
name = "${name}-${version}";
buildInputs = buildInputs ++ [ erlang rebar openssl libyaml ];
postPatch = ''
rm -f rebar
if [ -e "src/${name}.app.src" ]; then
sed -i -e 's/{ *vsn *,[^}]*}/{vsn, "${version}"}/' "src/${name}.app.src"
fi
${postPatch}
'';
configurePhase = let
getDeps = drv: [drv] ++ (map getDeps drv.erlangDeps);
recursiveDeps = uniqList {
inputList = flatten (map getDeps erlangDeps);
};
in ''
runHook preConfigure
${concatMapStrings (dep: ''
header "linking erlang dependency ${dep}"
mkdir deps
ln -s "${dep}" "deps/${dep.packageName}"
stopNest
'') recursiveDeps}
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
rebar compile
runHook postBuild
'';
installPhase = ''
runHook preInstall
for reldir in src ebin priv include; do
[ -e "$reldir" ] || continue
mkdir "$out"
cp -rt "$out" "$reldir"
success=1
done
runHook postInstall
'';
passthru = {
packageName = name;
inherit erlangDeps;
};
})

@ -0,0 +1,79 @@
{ stdenv, erlang, rebar3, openssl, libyaml }:
{ name, version
, buildInputs ? [], erlangDeps ? []
, postPatch ? ""
, ... }@attrs:
with stdenv.lib;
stdenv.mkDerivation (attrs // {
name = "${name}-${version}";
buildInputs = buildInputs ++ [ erlang rebar3 openssl libyaml ];
postPatch = ''
rm -f rebar rebar3
if [ -e "src/${name}.app.src" ]; then
sed -i -e 's/{ *vsn *,[^}]*}/{vsn, "${version}"}/' "src/${name}.app.src"
fi
${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
getDeps = drv: [drv] ++ (map getDeps drv.erlangDeps);
recursiveDeps = uniqList {
inputList = flatten (map getDeps erlangDeps);
};
in ''
runHook preConfigure
mkdir -p _build/default/lib/
${concatMapStrings (dep: ''
header "linking erlang dependency ${dep}"
ln -s "${dep}" "_build/default/lib/${dep.packageName}"
stopNest
'') recursiveDeps}
ls -laR
cat rebar.config || true
cat rebar.lock || true
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
DEBUG=1 HOME=. rebar3 update
DEBUG=1 HOME=. rebar3 compile
runHook postBuild
'';
installPhase = ''
ls -laR
runHook preInstall
mkdir "$out"
for reldir in src ebin priv include; do
fd="_build/default/lib/${name}/$reldir"
[ -d "$fd" ] || continue
cp -Hrt "$out" "$fd"
success=1
done
runHook postInstall
'';
# src = fetchurl {
# url = "https://s3.amazonaws.com/s3.hex.pm/tarballs/${name}-${version}.tar";
# sha256 = "1zjgbarclhh10cpgvfxikn9p2ay63rajq96q1sbz9r9w6v6p8jm9";
# };
passthru = {
packageName = name;
inherit erlangDeps;
};
})

@ -0,0 +1,38 @@
{ pkgs }: #? import <nixpkgs> {} }:
let
callPackage = pkgs.lib.callPackageWith (pkgs // self);
self = rec {
buildErlang = callPackage ./build-erlang.nix {};
buildHex = callPackage ./build-hex.nix {};
# dependencies for ejabberd
p1_utils = callPackage ./hex/p1_utils.nix {};
cache_tab = callPackage ./hex/cache_tab.nix {};
stringprep = callPackage ./hex/stringprep.nix {};
p1_xml = callPackage ./hex/p1_xml.nix {};
p1_tls = callPackage ./hex/p1_tls.nix {};
p1_stun = callPackage ./hex/p1_stun.nix {};
esip = callPackage ./hex/esip.nix {};
p1_yaml = callPackage ./hex/p1_yaml.nix {};
xmlrpc = callPackage ./hex/xmlrpc.nix {};
jiffy = callPackage ./hex/jiffy.nix {};
sync = callPackage ./hex/sync.nix {};
erlang-katana = callPackage ./hex/erlang-katana.nix {};
eper = callPackage ./hex/eper.nix {};
goldrush = callPackage ./hex/goldrush.nix {};
lager = callPackage ./hex/lager.nix {};
getopt = callPackage ./hex/getopt.nix {};
meck = callPackage ./hex/meck.nix {};
ibrowse = callPackage ./hex/ibrowse.nix {};
aleppo = callPackage ./hex/aleppo.nix {};
zipper = callPackage ./hex/zipper.nix {};
erlang-github = callPackage ./hex/erlang-github.nix {};
elvis = callPackage ./hex/elvis.nix {};
apns = callPackage ./hex/apns.nix {};
appmon = callPackage ./hex/appmon.nix {};
};
in self

@ -0,0 +1,11 @@
{ buildHex, fetchurl }:
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";
};
}

@ -0,0 +1,10 @@
{ buildErlang, fetchgit }:
buildErlang {
name = "ibrowse";
version = "0.1";
src = fetchgit {
url = "git://github.com/cmullaparthi/ibrowse.git";
sha256 = "1qvz4bmh307avjsxmhhdf35dd5wzmii0cbf6jyvvlhhkq4y0nmnj";
};
}

@ -0,0 +1,10 @@
{ buildErlang, fetchgit }:
buildErlang {
name = "jiffy";
version = "0.1";
src = fetchgit {
url = "git://github.com/davisp/jiffy.git";
sha256 = "02qb8m4s2p51m5f882ifsaph9fwx0bih37q5q90ba8cvsak65isx";
};
}

@ -0,0 +1,12 @@
{ buildHex, fetchurl, 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";
};
erlangDeps = [ goldrush ];
}

@ -0,0 +1,10 @@
{ buildErlang, fetchgit }:
buildErlang {
name = "meck";
version = "0.1";
src = fetchgit {
url = "git://github.com/eproxus/meck.git";
sha256 = "077p3v81mspy69247bz4apln3gp567m4xpmzxmdjd6pyh6m5ahpk";
};
}

@ -5021,6 +5021,8 @@ let
rebar = callPackage ../development/tools/build-managers/rebar { };
rebar3 = callPackage ../development/tools/build-managers/rebar3 { };
erlangPackages = callPackage ../development/erlang-modules { };
elixir = callPackage ../development/interpreters/elixir { };
groovy = callPackage ../development/interpreters/groovy { };