diff options
author | happysalada <raphael@megzari.com> | 2021-04-08 20:54:48 +0900 |
---|---|---|
committer | happysalada <raphael@megzari.com> | 2021-04-08 20:54:48 +0900 |
commit | 481832b32db4a9b1de5b5a04e9038520ff03fac3 (patch) | |
tree | 4cb50f02e3e82f354e7c6f67ad344cc0b9403b08 /pkgs/development/beam-modules/fetch-mix-deps.nix | |
parent | 1b1af195bb1e02a5d0548d27a11a5e12d377d62a (diff) | |
download | nixlib-481832b32db4a9b1de5b5a04e9038520ff03fac3.tar nixlib-481832b32db4a9b1de5b5a04e9038520ff03fac3.tar.gz nixlib-481832b32db4a9b1de5b5a04e9038520ff03fac3.tar.bz2 nixlib-481832b32db4a9b1de5b5a04e9038520ff03fac3.tar.lz nixlib-481832b32db4a9b1de5b5a04e9038520ff03fac3.tar.xz nixlib-481832b32db4a9b1de5b5a04e9038520ff03fac3.tar.zst nixlib-481832b32db4a9b1de5b5a04e9038520ff03fac3.zip |
beam-modules: buildMix -> mixRelease
Diffstat (limited to 'pkgs/development/beam-modules/fetch-mix-deps.nix')
-rw-r--r-- | pkgs/development/beam-modules/fetch-mix-deps.nix | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/pkgs/development/beam-modules/fetch-mix-deps.nix b/pkgs/development/beam-modules/fetch-mix-deps.nix index 020a82ad70b7..73365bd1a93e 100644 --- a/pkgs/development/beam-modules/fetch-mix-deps.nix +++ b/pkgs/development/beam-modules/fetch-mix-deps.nix @@ -1,34 +1,49 @@ { stdenvNoCC, lib, elixir, hex, rebar, rebar3, cacert, git }: -{ name, version, sha256, src, mixEnv ? "prod", debug ? false, meta ? { } }: - -stdenvNoCC.mkDerivation ({ - name = "mix-deps-${name}-${version}"; - +{ pname +, version +, sha256 +, src +, mixEnv ? "prod" +, debug ? false +, meta ? { } +, ... +}@attrs: + +stdenvNoCC.mkDerivation (attrs // { nativeBuildInputs = [ elixir hex cacert git ]; - inherit src; - MIX_ENV = mixEnv; MIX_DEBUG = if debug then 1 else 0; DEBUG = if debug then 1 else 0; # for rebar3 - - configurePhase = '' + # 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 export HEX_HOME="$TEMPDIR/.hex"; export MIX_HOME="$TEMPDIR/.mix"; - export MIX_DEPS_PATH="$out"; + export MIX_DEPS_PATH="$TEMPDIR/deps"; # Rebar - mix local.rebar rebar "${rebar}/bin/rebar" - mix local.rebar rebar3 "${rebar3}/bin/rebar3" export REBAR_GLOBAL_CONFIG_DIR="$TMPDIR/rebar3" export REBAR_CACHE_DIR="$TMPDIR/rebar3.cache" + runHook postConfigure ''; dontBuild = true; - installPhase = '' + installPhase = attrs.installPhase or '' + runHook preInstall mix deps.get --only ${mixEnv} + find "$TEMPDIR/deps" -path '*/.git/*' -a ! -name HEAD -exec rm -rf {} + + cp -r --no-preserve=mode,ownership,timestamps $TEMPDIR/deps $out + runHook postInstall ''; outputHashAlgo = "sha256"; |