2017-09-10 22:26:00 +01:00
|
|
|
{ stdenv, fetchFromGitHub, writeText, elixir }:
|
2016-03-28 22:14:13 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
shell = drv: stdenv.mkDerivation {
|
2017-09-10 22:26:00 +01:00
|
|
|
name = "interactive-shell-${drv.name}";
|
|
|
|
buildInputs = [ drv ];
|
|
|
|
};
|
2016-03-28 22:14:13 +01:00
|
|
|
|
|
|
|
pkg = self: stdenv.mkDerivation rec {
|
|
|
|
name = "hex";
|
2017-10-30 22:21:22 +00:00
|
|
|
version = "v0.17.1";
|
2016-03-28 22:14:13 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "hexpm";
|
|
|
|
repo = "hex";
|
2016-11-15 05:54:52 +00:00
|
|
|
rev = "${version}";
|
2017-10-30 22:21:22 +00:00
|
|
|
sha256 = "1s4asar1mcavzj3w37jcz243ka0z5jm0r42yws3h4aagawxxg02z";
|
2016-03-28 22:14:13 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
setupHook = writeText "setupHook.sh" ''
|
|
|
|
addToSearchPath ERL_LIBS "$1/lib/erlang/lib/"
|
|
|
|
'';
|
|
|
|
|
|
|
|
dontStrip = true;
|
|
|
|
|
|
|
|
buildInputs = [ elixir ];
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
export HEX_OFFLINE=1
|
|
|
|
export HEX_HOME=./
|
|
|
|
export MIX_ENV=prod
|
|
|
|
mix compile
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p $out/lib/erlang/lib
|
|
|
|
cp -r ./_build/prod/lib/hex $out/lib/erlang/lib/
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Package manager for the Erlang VM https://hex.pm";
|
|
|
|
license = stdenv.lib.licenses.mit;
|
2017-08-01 21:03:30 +01:00
|
|
|
homepage = https://github.com/hexpm/hex;
|
2016-03-28 22:14:13 +01:00
|
|
|
maintainers = with stdenv.lib.maintainers; [ ericbmerritt ];
|
|
|
|
};
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
env = shell self;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in stdenv.lib.fix pkg
|