nixpkgs/pkgs/development/beam-modules/hex/default.nix

58 lines
1.2 KiB
Nix
Raw Normal View History

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