rebar3WithPlugins
pkgs.beamPackages.rebar3WithPlugins
Docs pulled from | This Revision | about 1 hour ago
Contribute
Enhance the ecosystem with your expertise! Contribute to fill the gaps in documentation. Your input can make a difference.
Noogle detected
Implementation
The following is the current implementation of this function.
{
plugins ? [ ],
globalPlugins ? [ ],
rebar3 ? _rebar3,
}:
let
pluginLibDirs = map (p: "${p}/lib/erlang/lib") (lib.unique (plugins ++ globalPlugins));
globalPluginNames = lib.unique (map (p: p.pname) globalPlugins);
rebar3Patched = (
rebar3.overrideAttrs (old: {
# skip-plugins.patch is necessary because otherwise rebar3 will always
# try to fetch plugins if they are not already present in _build.
#
# global-deps.patch makes it possible to use REBAR_GLOBAL_PLUGINS to
# instruct rebar3 to always load a certain plugin. It is necessary since
# REBAR_GLOBAL_CONFIG_DIR doesn't seem to work for this.
patches = [
./skip-plugins.patch
./global-plugins.patch
];
# our patches cause the tests to fail
doCheck = false;
})
);
in
stdenv.mkDerivation {
pname = "rebar3-with-plugins";
inherit (rebar3) version;
nativeBuildInputs = [
erlang
makeWrapper
];
unpackPhase = "true";
# Here we extract the rebar3 escript (like `rebar3_prv_local_install.erl`) and
# add plugins to the code path.
installPhase = ''
erl -noshell -eval '
{ok, Escript} = escript:extract("${rebar3Patched}/bin/rebar3", []),
{archive, Archive} = lists:keyfind(archive, 1, Escript),
{ok, _} = zip:extract(Archive, [{cwd, "'$out/lib'"}]),
init:stop(0)
'
cp ${./rebar_ignore_deps.erl} rebar_ignore_deps.erl
erlc -o $out/lib/rebar/ebin rebar_ignore_deps.erl
mkdir -p $out/bin
makeWrapper ${erlang}/bin/erl $out/bin/rebar3 \
--set REBAR_GLOBAL_PLUGINS "${toString globalPluginNames} rebar_ignore_deps" \
--suffix-each ERL_LIBS ":" "$out/lib ${toString pluginLibDirs}" \
--add-flags "+sbtu +A1 -noshell -boot start_clean -s rebar3 main -extra"
'';
}