beam-modules: add fetch-mix-deps
This commit is contained in:
parent
f0b378026d
commit
7fbb9e8d04
@ -33,6 +33,7 @@ let
|
||||
buildRebar3 = callPackage ./build-rebar3.nix {};
|
||||
buildHex = callPackage ./build-hex.nix {};
|
||||
buildErlangMk = callPackage ./build-erlang-mk.nix {};
|
||||
fetchMixDeps = callPackage ./fetch-mix-deps.nix { };
|
||||
buildMix = callPackage ./build-mix.nix {};
|
||||
|
||||
# BEAM-based languages.
|
||||
|
41
pkgs/development/beam-modules/fetch-mix-deps.nix
Normal file
41
pkgs/development/beam-modules/fetch-mix-deps.nix
Normal file
@ -0,0 +1,41 @@
|
||||
{ stdenvNoCC, elixir, hex, rebar, rebar3, cacert }:
|
||||
|
||||
{ name, version, sha256, src, mixEnv ? "prod", debug ? false, meta ? { } }:
|
||||
|
||||
with stdenvNoCC.lib;
|
||||
|
||||
stdenvNoCC.mkDerivation ({
|
||||
name = "mix-deps-${name}-${version}";
|
||||
|
||||
phases = [ "configurePhase" "downloadPhase" ];
|
||||
|
||||
nativeBuildInputs = [ elixir hex cacert ];
|
||||
|
||||
inherit src;
|
||||
|
||||
MIX_ENV = mixEnv;
|
||||
MIX_REBAR = "${rebar}/bin/rebar";
|
||||
MIX_REBAR3 = "${rebar3}/bin/rebar3";
|
||||
MIX_DEBUG = if debug then 1 else 0;
|
||||
|
||||
configurePhase = ''
|
||||
mkdir -p $out/deps
|
||||
mkdir -p $out/.hex
|
||||
export HEX_HOME="$out/.hex";
|
||||
export MIX_HOME="$TEMPDIR/.mix";
|
||||
export MIX_DEPS_PATH="$out/deps";
|
||||
'';
|
||||
|
||||
downloadPhase = ''
|
||||
ln -s ${src}/mix.exs ./mix.exs
|
||||
ln -s ${src}/mix.lock ./mix.lock
|
||||
mix deps.get --only ${mixEnv}
|
||||
'';
|
||||
|
||||
outputHashAlgo = "sha256";
|
||||
outputHashMode = "recursive";
|
||||
outputHash = sha256;
|
||||
|
||||
impureEnvVars = stdenvNoCC.lib.fetchers.proxyImpureEnvVars;
|
||||
inherit meta;
|
||||
})
|
Loading…
Reference in New Issue
Block a user