summary refs log tree commit diff
path: root/pkgs/development/beam-modules/hex
diff options
context:
space:
mode:
authorEric Merritt <eric@merritt.tech>2016-03-28 14:14:13 -0700
committerEric Merritt <eric@merritt.tech>2016-04-23 19:03:24 -0700
commit8dbcb4e35ecc2513dab1ed8cb6052f68ab0a6537 (patch)
tree7c59313015440aa0adeed1acf01e9445081b308d /pkgs/development/beam-modules/hex
parent3b7aee2e5a87b256aaff903a33106d974a25dbef (diff)
downloadnixpkgs-8dbcb4e35ecc2513dab1ed8cb6052f68ab0a6537.tar
nixpkgs-8dbcb4e35ecc2513dab1ed8cb6052f68ab0a6537.tar.gz
nixpkgs-8dbcb4e35ecc2513dab1ed8cb6052f68ab0a6537.tar.bz2
nixpkgs-8dbcb4e35ecc2513dab1ed8cb6052f68ab0a6537.tar.lz
nixpkgs-8dbcb4e35ecc2513dab1ed8cb6052f68ab0a6537.tar.xz
nixpkgs-8dbcb4e35ecc2513dab1ed8cb6052f68ab0a6537.tar.zst
nixpkgs-8dbcb4e35ecc2513dab1ed8cb6052f68ab0a6537.zip
beamPackages: Add support for Mix and Erlang.mk
Diffstat (limited to 'pkgs/development/beam-modules/hex')
-rw-r--r--pkgs/development/beam-modules/hex/default.nix58
1 files changed, 58 insertions, 0 deletions
diff --git a/pkgs/development/beam-modules/hex/default.nix b/pkgs/development/beam-modules/hex/default.nix
new file mode 100644
index 00000000000..2cb06b07e59
--- /dev/null
+++ b/pkgs/development/beam-modules/hex/default.nix
@@ -0,0 +1,58 @@
+{stdenv, fetchFromGitHub, writeText, elixir }:
+
+let
+  shell = drv: stdenv.mkDerivation {
+          name = "interactive-shell-${drv.name}";
+          buildInputs = [ drv ];
+    };
+
+  pkg = self: stdenv.mkDerivation rec {
+    name = "hex";
+    version = "v0.11.3";
+
+    src = fetchFromGitHub {
+        owner = "hexpm";
+        repo = "hex";
+        rev = "f5e200ad95f030f0a7ab88a86545dd0dde1ee521";
+        sha256 = "0n4cgmnbmglarydls9pmxznbzp49pv85ncbd4f2lp1fm7qr08xfw";
+    };
+
+    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;
+      homepage = "https://github.com/hexpm/hex";
+      maintainers = with stdenv.lib.maintainers; [ ericbmerritt ];
+    };
+
+    passthru = {
+      env = shell self;
+    };
+
+};
+in stdenv.lib.fix pkg