Add support for rebar3 plugins to buildHex.

Allow specifying pluginDeps for buildHex listing rebar3 plugins which
are required for given package to be built by rebar3.
This commit is contained in:
Gleb Peregud 2015-12-10 23:11:25 +01:00
parent eac25eaf69
commit 3a9110b15c
4 changed files with 22 additions and 3 deletions

@ -2,7 +2,7 @@
{ name, version, sha256
, hexPkg ? name
, buildInputs ? [], erlangDeps ? []
, buildInputs ? [], erlangDeps ? [], pluginDeps ? []
, postPatch ? ""
, compilePorts ? false
, ... }@attrs:
@ -39,14 +39,22 @@ stdenv.mkDerivation (attrs // {
recursiveDeps = uniqList {
inputList = flatten (map getDeps erlangDeps);
};
recursivePluginsDeps = uniqList {
inputList = flatten (map getDeps pluginDeps);
};
in ''
runHook preConfigure
mkdir -p _build/default/lib/
mkdir -p _build/default/{lib,plugins}/
${concatMapStrings (dep: ''
header "linking erlang dependency ${dep}"
ln -s "${dep}" "_build/default/lib/${dep.packageName}"
stopNest
'') recursiveDeps}
${concatMapStrings (dep: ''
header "linking rebar3 plugins ${dep}"
ln -s "${dep}" "_build/default/plugins/${dep.packageName}"
stopNest
'') recursivePluginsDeps}
runHook postConfigure
'';
@ -55,7 +63,9 @@ stdenv.mkDerivation (attrs // {
buildPhase = ''
runHook preBuild
HOME=. rebar3 do update, compile
${if compilePorts then ''
HOME=. rebar3 pc compile
'' else ''''}
runHook postBuild
'';

@ -7,6 +7,7 @@ let
buildErlang = callPackage ./build-erlang.nix {};
buildHex = callPackage ./build-hex.nix {};
rebar3-pc = callPackage ./hex/rebar3-pc.nix {};
esqlite = callPackage ./hex/esqlite.nix {};
goldrush = callPackage ./hex/goldrush.nix {};
ibrowse = callPackage ./hex/ibrowse.nix {};

@ -1,8 +1,9 @@
{ buildHex }:
{ buildHex, rebar3-pc }:
buildHex {
name = "esqlite";
version = "0.2.1";
sha256 = "1296fn1lz4lz4zqzn4dwc3flgkh0i6n4sydg501faabfbv8d3wkr";
compilePorts = true;
pluginDeps = [ rebar3-pc ];
}

@ -0,0 +1,7 @@
{ buildHex, goldrush }:
buildHex {
name = "pc";
version = "1.1.0";
sha256 = "1br5xfl4b2z70b6a2ccxppn64jvkqgpmy4y9v81kxzb91z0ss9ma";
}