Add "compilePorts" enabling rebar3 "pc" plugin

If compilePorts is enabled plugin "pc" is added to the rebar.config
during postPatch. This makes rebar3 compile download the plugin, hence
added TODO.
This commit is contained in:
Gleb Peregud 2015-12-10 22:39:42 +01:00
parent 2251a942fc
commit 406b974420
3 changed files with 22 additions and 0 deletions

View File

@ -4,6 +4,7 @@
, hexPkg ? name
, buildInputs ? [], erlangDeps ? []
, postPatch ? ""
, compilePorts ? false
, ... }@attrs:
with stdenv.lib;
@ -18,6 +19,16 @@ stdenv.mkDerivation (attrs // {
if [ -e "src/${name}.app.src" ]; then
sed -i -e 's/{ *vsn *,[^}]*}/{vsn, "${version}"}/' "src/${name}.app.src"
fi
# TODO: figure out how to provide 'pc' plugin hermetically
${if compilePorts then ''
echo "{plugins, [pc]}.
{provider_hooks,
[{post,
[{compile, {pc, compile}},
{clean, {pc, clean}}]}]}." >> rebar.config
'' else ''''}
${postPatch}
'';
@ -43,6 +54,8 @@ stdenv.mkDerivation (attrs // {
runHook postConfigure
'';
# TODO: figure out how to provide rebar3 a static registry snapshot to make
# this hermetic
buildPhase = ''
runHook preBuild
HOME=. rebar3 update

View File

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

View File

@ -0,0 +1,8 @@
{ buildHex }:
buildHex {
name = "esqlite";
version = "0.2.1";
sha256 = "1296fn1lz4lz4zqzn4dwc3flgkh0i6n4sydg501faabfbv8d3wkr";
compilePorts = true;
}