tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
erlang: fix rebar3-nix-bootstrap in Erlang < R18.
Gleb Peregud
8 years ago
f66b0186
d1b9c9d2
+13
-5
1 changed file
expand all
collapse all
unified
split
pkgs
development
tools
build-managers
rebar3
rebar3-nix-bootstrap
+13
-5
pkgs/development/tools/build-managers/rebar3/rebar3-nix-bootstrap
···
180
180
erlang:halt(1)
181
181
end.
182
182
183
183
-
-spec gather_required_data_from_the_environment(#data{}) -> {ok, map()}.
183
183
+
-spec gather_required_data_from_the_environment(#data{}) -> {ok, #data{}}.
184
184
gather_required_data_from_the_environment(ArgData) ->
185
185
{ok, ArgData#data{ version = guard_env("version")
186
186
-
, erl_libs = os:getenv("ERL_LIBS", [])
187
187
-
, plugins = os:getenv("buildPlugins", [])
186
186
+
, erl_libs = get_env("ERL_LIBS", [])
187
187
+
, plugins = get_env("buildPlugins", [])
188
188
, root = code:root_dir()
189
189
, name = guard_env("name")
190
190
-
, compile_ports = nix2bool(os:getenv("compilePorts", ""))
190
190
+
, compile_ports = nix2bool(get_env("compilePorts", ""))
191
191
, registry_snapshot = guard_env("HEX_REGISTRY_SNAPSHOT")}}.
192
192
193
193
-spec nix2bool(any()) -> boolean().
···
196
196
nix2bool("") ->
197
197
false.
198
198
199
199
+
get_env(Name) ->
200
200
+
os:getenv(Name).
201
201
+
get_env(Name, Def) ->
202
202
+
case get_env(Name) of
203
203
+
false -> Def;
204
204
+
Val -> Val
205
205
+
end.
206
206
+
199
207
-spec guard_env(string()) -> string().
200
208
guard_env(Name) ->
201
201
-
case os:getenv(Name) of
209
209
+
case get_env(Name) of
202
210
false ->
203
211
stderr("Expected Environment variable ~s! Are you sure you are "
204
212
"running in a Nix environment? Either a nix-build, "