Something went wrong. Try again.
What happens if I push all of nixpkgs
Something went wrong. Try again.
2.3 kB · 115 lines
Nix
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116{ stdenv, writeText, erlang, rebar3WithPlugins, openssl, libyaml, lib,}:
{ name, version, src, setupHook ? null, buildInputs ? [ ], beamDeps ? [ ], buildPlugins ? [ ], postPatch ? "", installPhase ? null, buildPhase ? null, configurePhase ? null, meta ? { }, enableDebugInfo ? false, ...}@attrs:
let debugInfoFlag = lib.optionalString (enableDebugInfo || erlang.debugInfo) "debug-info";
rebar3 = rebar3WithPlugins { plugins = buildPlugins; };
shell = drv: stdenv.mkDerivation { name = "interactive-shell-${drv.name}"; buildInputs = [ drv ]; };
customPhases = lib.filterAttrs (_: v: v != null) { inherit setupHook configurePhase buildPhase installPhase ; };
pkg = self: stdenv.mkDerivation ( attrs // {
name = "${name}-${version}"; inherit version;
buildInputs = buildInputs ++ [ erlang rebar3 openssl libyaml ]; propagatedBuildInputs = lib.unique beamDeps;
inherit src;
# stripping does not have any effect on beam files # it is however needed for dependencies with NIFs # false is the default but we keep this for readability dontStrip = false;
setupHook = writeText "setupHook.sh" '' addToSearchPath ERL_LIBS "$1/lib/erlang/lib/" '';
postPatch = '' rm -f rebar rebar3 '' + postPatch;
buildPhase = '' runHook preBuild HOME=. rebar3 bare compile -path "" runHook postBuild '';
installPhase = '' runHook preInstall mkdir -p "$out/lib/erlang/lib/${name}-${version}" for reldir in src ebin priv include; do [ -d "$reldir" ] || continue # $out/lib/erlang/lib is a convention used in nixpkgs for compiled BEAM packages cp -Hrt "$out/lib/erlang/lib/${name}-${version}" "$reldir" done runHook postInstall '';
meta = { inherit (erlang.meta) platforms; } // meta;
passthru = { packageName = name; env = shell self; inherit beamDeps; }; } // customPhases );inlib.fix pkg