2021-01-24 21:00:19 +01:00
|
|
|
{ lib, stdenv, fetchFromGitHub, writeText, elixir }:
|
2016-03-28 23:14:13 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
shell = drv: stdenv.mkDerivation {
|
2017-09-10 23:26:00 +02:00
|
|
|
name = "interactive-shell-${drv.name}";
|
|
|
|
buildInputs = [ drv ];
|
|
|
|
};
|
2016-03-28 23:14:13 +02:00
|
|
|
|
|
|
|
pkg = self: stdenv.mkDerivation rec {
|
2018-11-05 00:46:58 +01:00
|
|
|
pname = "hex";
|
2021-04-23 07:14:33 +02:00
|
|
|
version = "0.21.2";
|
2016-03-28 23:14:13 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2020-02-05 10:05:31 +01:00
|
|
|
owner = "hexpm";
|
|
|
|
repo = "hex";
|
|
|
|
rev = "v${version}";
|
2021-04-23 07:14:33 +02:00
|
|
|
sha256 = "18vwrc5b7pyi3nifmx5hd5wbz8fy3h6sfvkmskjg5acmz66fys0g";
|
2016-03-28 23:14:13 +02: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-01-23 18:15:07 +01:00
|
|
|
license = lib.licenses.mit;
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/hexpm/hex";
|
2021-01-23 18:15:07 +01:00
|
|
|
maintainers = with lib.maintainers; [ ericbmerritt ];
|
2016-03-28 23:14:13 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
env = shell self;
|
|
|
|
};
|
|
|
|
};
|
2021-01-23 18:15:07 +01:00
|
|
|
in lib.fix pkg
|