Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / beam-modules / hex / default.nix
blob32628886f11f60df791ec6f4c6e56ba5db4808df
1 { lib, stdenv, fetchFromGitHub, writeText, elixir }:
3 let
4   shell = drv: stdenv.mkDerivation {
5     name = "interactive-shell-${drv.name}";
6     buildInputs = [ drv ];
7   };
9   pkg = self: stdenv.mkDerivation rec {
10     pname = "hex";
11     version = "2.0.6";
13     src = fetchFromGitHub {
14       owner = "hexpm";
15       repo = "hex";
16       rev = "v${version}";
17       sha256 = "sha256-fSADQDrqh5U/TdhaHXsMiLMk1wtQ0gEiTqEclJ2w2nY=";
18     };
20     setupHook = writeText "setupHook.sh" ''
21        addToSearchPath ERL_LIBS "$1/lib/erlang/lib/"
22     '';
24     dontStrip = true;
26     buildInputs = [ elixir ];
28     buildPhase = ''
29       runHook preBuild
30       export HEX_OFFLINE=1
31       export HEX_HOME=./
32       export MIX_ENV=prod
33       mix compile
34       runHook postBuild
35     '';
37     installPhase = ''
38       runHook preInstall
40       mkdir -p $out/lib/erlang/lib
41       cp -r ./_build/prod/lib/hex $out/lib/erlang/lib/
43       runHook postInstall
44     '';
46     meta = {
47       description = "Package manager for the Erlang VM https://hex.pm";
48       license = lib.licenses.mit;
49       homepage = "https://github.com/hexpm/hex";
50       maintainers = with lib.maintainers; [ ericbmerritt ];
51     };
53     passthru = {
54       env = shell self;
55     };
57 in lib.fix pkg