diff options
author | Eric Merritt <eric@merritt.tech> | 2016-03-28 14:14:13 -0700 |
---|---|---|
committer | Eric Merritt <eric@merritt.tech> | 2016-04-23 19:03:24 -0700 |
commit | 8dbcb4e35ecc2513dab1ed8cb6052f68ab0a6537 (patch) | |
tree | 7c59313015440aa0adeed1acf01e9445081b308d /pkgs/development/beam-modules/build-erlang-mk.nix | |
parent | 3b7aee2e5a87b256aaff903a33106d974a25dbef (diff) | |
download | nixlib-8dbcb4e35ecc2513dab1ed8cb6052f68ab0a6537.tar nixlib-8dbcb4e35ecc2513dab1ed8cb6052f68ab0a6537.tar.gz nixlib-8dbcb4e35ecc2513dab1ed8cb6052f68ab0a6537.tar.bz2 nixlib-8dbcb4e35ecc2513dab1ed8cb6052f68ab0a6537.tar.lz nixlib-8dbcb4e35ecc2513dab1ed8cb6052f68ab0a6537.tar.xz nixlib-8dbcb4e35ecc2513dab1ed8cb6052f68ab0a6537.tar.zst nixlib-8dbcb4e35ecc2513dab1ed8cb6052f68ab0a6537.zip |
beamPackages: Add support for Mix and Erlang.mk
Diffstat (limited to 'pkgs/development/beam-modules/build-erlang-mk.nix')
-rw-r--r-- | pkgs/development/beam-modules/build-erlang-mk.nix | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/pkgs/development/beam-modules/build-erlang-mk.nix b/pkgs/development/beam-modules/build-erlang-mk.nix new file mode 100644 index 000000000000..8c2b72aa43cf --- /dev/null +++ b/pkgs/development/beam-modules/build-erlang-mk.nix @@ -0,0 +1,86 @@ +{ stdenv, writeText, erlang, perl, which, gitMinimal, wget }: + +{ name, version +, src +, setupHook ? null +, buildInputs ? [] +, beamDeps ? [] +, postPatch ? "" +, compilePorts ? false +, installPhase ? null +, meta ? {} +, ... }@attrs: + +with stdenv.lib; + +let + shell = drv: stdenv.mkDerivation { + name = "interactive-shell-${drv.name}"; + buildInputs = [ drv ]; + }; + + pkg = self: stdenv.mkDerivation ( attrs // { + app_name = "${name}"; + name = "${name}-${version}"; + inherit version; + + dontStrip = true; + + inherit src; + + setupHook = if setupHook == null + then writeText "setupHook.sh" '' + addToSearchPath ERL_LIBS "$1/lib/erlang/lib" + '' + else setupHook; + + buildInputs = [ erlang perl which gitMinimal wget ]; + propagatedBuildInputs = beamDeps; + + configurePhase = '' + runHook preConfigure + + # We shouldnt need to do this, but it seems at times there is a *.app in + # the repo/package. This ensures we start from a clean slate + make SKIP_DEPS=1 clean + + runHook postConfigure + ''; + + buildPhase = '' + runHook preBuild + + make SKIP_DEPS=1 + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out/lib/erlang/lib/${name} + cp -r ebin $out/lib/erlang/lib/${name}/ + cp -r src $out/lib/erlang/lib/${name}/ + + if [ -d include ]; then + cp -r include $out/lib/erlang/lib/${name}/ + fi + + if [ -d priv ]; then + cp -r priv $out/lib/erlang/lib/${name}/ + fi + + if [ -d doc ]; then + cp -r doc $out/lib/erlang/lib/${name}/ + fi + + runHook postInstall + ''; + + passthru = { + packageName = name; + env = shell self; + inherit beamDeps; + }; +}); +in fix pkg |