Skip to content

Commit 02a415f

Browse files
author
José Valim
committed
Add MIX_ARCHIVES env variable
1 parent 5cee190 commit 02a415f

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

lib/mix/lib/mix/local.ex

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,18 @@ defmodule Mix.Local do
33

44
@doc """
55
The path for local archives.
6+
7+
It checks the `MIX_ARCHIVES` variable or it uses the
8+
"archives" directory inside `Mix.Utils.mix_home/0`.
9+
10+
Since archives are specific to Elixir versions, it is
11+
expected from build tools to swap the `MIX_ARCHIVES`
12+
variable to different locations based on a particular
13+
Elixir installation.
614
"""
715
def archives_path do
8-
Path.join Mix.Utils.mix_home, "archives"
16+
System.get_env("MIX_ARCHIVES") ||
17+
Path.join(Mix.Utils.mix_home, "archives")
918
end
1019

1120
@doc """

lib/mix/lib/mix/utils.ex

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ defmodule Mix.Utils do
99
It defaults to `~/.mix` unless the `MIX_HOME`
1010
environment variable is set.
1111
12-
Mix stores archives and configurations in the `MIX_HOME`
13-
directory. Since archives and configurations may be
14-
specific to an Elixir version, it is expected from build
15-
tools to swap the `MIX_HOME` to different locations
16-
based on particular Elixir installations.
12+
Developers should only store entries in the
13+
`MIX_HOME` directory which are guaranteed to
14+
work accross multiple Elixir versions, as it is
15+
not recommended to swap the `MIX_HOME` directory
16+
as configuration and other important data may be
17+
stored there.
1718
"""
1819
def mix_home do
1920
System.get_env("MIX_HOME") || Path.expand("~/.mix")

0 commit comments

Comments
 (0)