nixpkgs/pkgs/development/beam-modules/fetch-mix-deps.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

61 lines
1.5 KiB
Nix
Raw Normal View History

{ stdenvNoCC, lib, elixir, hex, rebar, rebar3, cacert, git }@inputs:
2020-12-23 05:16:44 +01:00
2021-04-08 13:54:48 +02:00
{ pname
, version
, sha256
, src
, mixEnv ? "prod"
, debug ? false
, meta ? { }
, patches ? []
, elixir ? inputs.elixir
, hex ? inputs.hex.override { inherit elixir; }
2021-04-08 13:54:48 +02:00
, ...
}@attrs:
stdenvNoCC.mkDerivation (attrs // {
2020-12-31 04:27:08 +01:00
nativeBuildInputs = [ elixir hex cacert git ];
2020-12-23 05:16:44 +01:00
MIX_ENV = mixEnv;
MIX_DEBUG = if debug then 1 else 0;
DEBUG = if debug then 1 else 0; # for rebar3
2021-04-08 13:54:48 +02:00
# the api with `mix local.rebar rebar path` makes a copy of the binary
MIX_REBAR = "${rebar}/bin/rebar";
MIX_REBAR3 = "${rebar3}/bin/rebar3";
# there is a persistent download failure with absinthe 1.6.3
# those defaults reduce the failure rate
HEX_HTTP_CONCURRENCY = 1;
HEX_HTTP_TIMEOUT = 120;
configurePhase = attrs.configurePhase or ''
runHook preConfigure
2021-01-03 04:09:49 +01:00
export HEX_HOME="$TEMPDIR/.hex";
2020-12-23 05:16:44 +01:00
export MIX_HOME="$TEMPDIR/.mix";
2021-04-08 13:54:48 +02:00
export MIX_DEPS_PATH="$TEMPDIR/deps";
# Rebar
export REBAR_GLOBAL_CONFIG_DIR="$TMPDIR/rebar3"
export REBAR_CACHE_DIR="$TMPDIR/rebar3.cache"
2021-04-08 13:54:48 +02:00
runHook postConfigure
2020-12-23 05:16:44 +01:00
'';
inherit patches;
dontBuild = true;
2021-04-08 13:54:48 +02:00
installPhase = attrs.installPhase or ''
runHook preInstall
2020-12-23 05:16:44 +01:00
mix deps.get --only ${mixEnv}
2021-04-08 13:54:48 +02:00
find "$TEMPDIR/deps" -path '*/.git/*' -a ! -name HEAD -exec rm -rf {} +
cp -r --no-preserve=mode,ownership,timestamps $TEMPDIR/deps $out
runHook postInstall
2020-12-23 05:16:44 +01:00
'';
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = sha256;
impureEnvVars = lib.fetchers.proxyImpureEnvVars;
2020-12-23 05:16:44 +01:00
inherit meta;
})