2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, writeText, elixir }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
shell = drv: stdenv.mkDerivation {
|
|
|
|
name = "interactive-shell-${drv.name}";
|
|
|
|
buildInputs = [ drv ];
|
|
|
|
};
|
|
|
|
|
|
|
|
pkg = self: stdenv.mkDerivation rec {
|
|
|
|
pname = "hex";
|
2021-12-19 01:06:50 +00:00
|
|
|
version = "1.0.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "hexpm";
|
|
|
|
repo = "hex";
|
|
|
|
rev = "v${version}";
|
2021-12-19 01:06:50 +00:00
|
|
|
sha256 = "sha256-5g2MDbStlUrAPQCv1xWp+oPyRIOqARmlsKo/ONLTLnY=";
|
2020-04-24 23:36:52 +00: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";
|
2021-02-05 17:12:51 +00:00
|
|
|
license = lib.licenses.mit;
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/hexpm/hex";
|
2021-02-05 17:12:51 +00:00
|
|
|
maintainers = with lib.maintainers; [ ericbmerritt ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
env = shell self;
|
|
|
|
};
|
|
|
|
};
|
2021-02-05 17:12:51 +00:00
|
|
|
in lib.fix pkg
|