mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-29 06:45:54 +03:00
Merge pull request #29227 from gleber/beam-tooling-upgrade
beam: tooling upgrade (rebar3, hex2nix, relx, etc)
This commit is contained in:
commit
b1140f92cc
9
.github/CODEOWNERS
vendored
9
.github/CODEOWNERS
vendored
@ -38,3 +38,12 @@ pkgs/development/r-modules @peti
|
||||
pkgs/stdenv/darwin/* @copumpkin @LnL7
|
||||
pkgs/os-specific/darwin/* @LnL7
|
||||
pkgs/os-specific/darwin/apple-source-releases/* @copumpkin
|
||||
|
||||
# Beam-related (Erlang, Elixir, LFE, etc)
|
||||
pkgs/development/beam-modules/* @gleber
|
||||
pkgs/development/interpreters/erlang/* @gleber
|
||||
pkgs/development/interpreters/lfe/* @gleber
|
||||
pkgs/development/interpreters/elixir/* @gleber
|
||||
pkgs/development/tools/build-managers/rebar/* @gleber
|
||||
pkgs/development/tools/build-managers/rebar3/* @gleber
|
||||
pkgs/development/tools/erlang/* @gleber
|
||||
|
@ -20,6 +20,8 @@ let
|
||||
inherit callPackage erlang;
|
||||
beamPackages = self;
|
||||
|
||||
hexRegistrySnapshot = callPackage ./hex-registry-snapshot.nix { };
|
||||
|
||||
rebar = callPackage ../tools/build-managers/rebar { };
|
||||
rebar3-open = callPackage ../tools/build-managers/rebar3 {
|
||||
hermeticRebar3 = false;
|
||||
@ -28,7 +30,10 @@ let
|
||||
hermeticRebar3 = true;
|
||||
};
|
||||
|
||||
hexRegistrySnapshot = callPackage ./hex-registry-snapshot.nix { };
|
||||
# rebar3 port compiler plugin is required by buildRebar3
|
||||
pc_1_6_0 = callPackage ./pc {};
|
||||
pc = pc_1_6_0;
|
||||
|
||||
fetchHex = callPackage ./fetch-hex.nix { };
|
||||
|
||||
buildRebar3 = callPackage ./build-rebar3.nix {};
|
||||
@ -57,12 +62,35 @@ let
|
||||
lfe = lfe_1_2;
|
||||
lfe_1_2 = lib.callLFE ../interpreters/lfe/1.2.nix { inherit erlang buildRebar3 buildHex; };
|
||||
|
||||
# Non hex packages
|
||||
# We list all base hex packages for beam tooling explicitly to ensure
|
||||
# tha the tooling does not break during hex-packages.nix updates.
|
||||
erlware_commons_1_0_0 = buildHex {
|
||||
name = "erlware_commons";
|
||||
version = "1.0.0";
|
||||
sha256 = "0wkphbrjk19lxdwndy92v058qwcaz13bcgdzp33h21aa7vminzx7";
|
||||
beamDeps = [ cf_0_2_2 ];
|
||||
};
|
||||
cf_0_2_2 = buildHex {
|
||||
name = "cf";
|
||||
version = "0.2.2";
|
||||
sha256 = "08cvy7skn5d2k4manlx5k3anqgjdvajjhc5jwxbaszxw34q3na28";
|
||||
};
|
||||
getopt_0_8_2 = buildHex {
|
||||
name = "getopt";
|
||||
version = "0.8.2";
|
||||
sha256 = "1xw30h59zbw957cyjd8n50hf9y09jnv9dyry6x3avfwzcyrnsvkk";
|
||||
};
|
||||
|
||||
# Non hex packages. Examples how to build Rebar/Mix packages with and
|
||||
# without helper functions buildRebar3 and buildMix.
|
||||
hex = callPackage ./hex {};
|
||||
webdriver = callPackage ./webdriver {};
|
||||
|
||||
hex2nix = callPackage ../tools/erlang/hex2nix {};
|
||||
cuter = callPackage ../tools/erlang/cuter {};
|
||||
relxExe = callPackage ../tools/erlang/relx-exe {};
|
||||
|
||||
# The tool used to upgrade hex-packages.nix.
|
||||
hex2nix = callPackage ../tools/erlang/hex2nix {};
|
||||
|
||||
# An example of Erlang/C++ package.
|
||||
cuter = callPackage ../tools/erlang/cuter {};
|
||||
};
|
||||
in makeExtensible packages
|
||||
|
@ -2,14 +2,15 @@
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "hex-registry";
|
||||
rev = "e5e494a";
|
||||
rev = "9f736e7";
|
||||
version = "0.0.0+build.${rev}";
|
||||
|
||||
# src = /home/gleber/code/erl/hex-pm-registry-snapshots;
|
||||
src = fetchFromGitHub {
|
||||
owner = "erlang-nix";
|
||||
repo = "hex-pm-registry-snapshots";
|
||||
inherit rev;
|
||||
sha256 = "0877dragfxs22a05d8mv42z5535kfx9rs4y7fwwbd1ybphczf8za";
|
||||
sha256 = "1xiw5yifyk3bbmr0cr82y1nc4c6zk11f6azdv07glb7yrgccrv79";
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
|
@ -1,10 +1,10 @@
|
||||
{stdenv, fetchFromGitHub, writeText, elixir }:
|
||||
{ stdenv, fetchFromGitHub, writeText, elixir }:
|
||||
|
||||
let
|
||||
shell = drv: stdenv.mkDerivation {
|
||||
name = "interactive-shell-${drv.name}";
|
||||
buildInputs = [ drv ];
|
||||
};
|
||||
name = "interactive-shell-${drv.name}";
|
||||
buildInputs = [ drv ];
|
||||
};
|
||||
|
||||
pkg = self: stdenv.mkDerivation rec {
|
||||
name = "hex";
|
||||
@ -53,6 +53,5 @@ let
|
||||
passthru = {
|
||||
env = shell self;
|
||||
};
|
||||
|
||||
};
|
||||
in stdenv.lib.fix pkg
|
||||
|
13
pkgs/development/beam-modules/pc/default.nix
Normal file
13
pkgs/development/beam-modules/pc/default.nix
Normal file
@ -0,0 +1,13 @@
|
||||
{ stdenv, buildHex }:
|
||||
|
||||
buildHex {
|
||||
name = "pc";
|
||||
version = "1.6.0";
|
||||
sha256 = "0xq411ig5ny3iilkkkqa4vm3w3dgjc9cfzkqwk8pm13dw9mcm8h0";
|
||||
|
||||
meta = {
|
||||
description = ''a rebar3 port compiler for native code'';
|
||||
license = stdenv.lib.licenses.mit;
|
||||
homepage = "https://github.com/blt/port_compiler";
|
||||
};
|
||||
}
|
@ -2,9 +2,9 @@
|
||||
|
||||
let
|
||||
shell = drv: stdenv.mkDerivation {
|
||||
name = "interactive-shell-${drv.name}";
|
||||
buildInputs = [ drv ];
|
||||
};
|
||||
name = "interactive-shell-${drv.name}";
|
||||
buildInputs = [ drv ];
|
||||
};
|
||||
|
||||
pkg = self: stdenv.mkDerivation rec {
|
||||
name = "webdriver";
|
||||
|
@ -3,64 +3,64 @@
|
||||
tree, fetchFromGitHub, hexRegistrySnapshot }:
|
||||
|
||||
let
|
||||
version = "3.3.2";
|
||||
version = "3.4.3";
|
||||
|
||||
bootstrapper = ./rebar3-nix-bootstrap;
|
||||
|
||||
bbmustache = fetchHex {
|
||||
pkg = "bbmustache";
|
||||
version = "1.3.0";
|
||||
sha256 = "042pfgss8kscq6ssg8gix8ccmdsrx0anjczsbrn2a6c36ljrx2p6";
|
||||
erlware_commons = fetchHex {
|
||||
pkg = "erlware_commons";
|
||||
version = "1.0.0";
|
||||
sha256 = "0wkphbrjk19lxdwndy92v058qwcaz13bcgdzp33h21aa7vminzx7";
|
||||
};
|
||||
ssl_verify_fun = fetchHex {
|
||||
pkg = "ssl_verify_fun";
|
||||
version = "1.1.2";
|
||||
sha256 = "0qdyx70v09fydv4wzz1djnkixqj62ny40yjjhv2q6mh47lns2arj";
|
||||
};
|
||||
certifi = fetchHex {
|
||||
pkg = "certifi";
|
||||
version = "0.4.0";
|
||||
sha256 = "04bnvsbssdcf6b9h9bfglflds7j0gx6q5igl1xxhx6fnwaz37hhw";
|
||||
};
|
||||
cf = fetchHex {
|
||||
pkg = "cf";
|
||||
version = "0.2.1";
|
||||
sha256 = "19d0yvg8wwa57cqhn3vqfvw978nafw8j2rvb92s3ryidxjkrmvms";
|
||||
};
|
||||
cth_readable = fetchHex {
|
||||
pkg = "cth_readable";
|
||||
version = "1.2.3";
|
||||
sha256 = "0wfpfismzi2q0nzvx9qyllch4skwmsk6yqffw8iw2v48ssbfvfhz";
|
||||
};
|
||||
erlware_commons = fetchHex {
|
||||
pkg = "erlware_commons";
|
||||
version = "0.21.0";
|
||||
sha256 = "0gxb011m637rca2g0vhm1q9krm3va50rz1py6zf8k92q4iv9a2p7";
|
||||
};
|
||||
eunit_formatters = fetchHex {
|
||||
pkg = "eunit_formatters";
|
||||
version = "0.3.1";
|
||||
sha256 = "0cg9dasv60v09q3q4wja76pld0546mhmlpb0khagyylv890hg934";
|
||||
};
|
||||
getopt = fetchHex {
|
||||
pkg = "getopt";
|
||||
version = "0.8.2";
|
||||
sha256 = "1xw30h59zbw957cyjd8n50hf9y09jnv9dyry6x3avfwzcyrnsvkk";
|
||||
version = "2.0.0";
|
||||
sha256 = "075v7cvny52jbhnskchd3fp68fxgp7qfvdls0haamcycxrn0dipx";
|
||||
};
|
||||
providers = fetchHex {
|
||||
pkg = "providers";
|
||||
version = "1.6.0";
|
||||
sha256 = "0byfa1h57n46jilz4q132j0vk3iqc0v1vip89li38gb1k997cs0g";
|
||||
};
|
||||
ssl_verify_fun = fetchHex {
|
||||
pkg = "ssl_verify_fun";
|
||||
version = "1.1.1";
|
||||
sha256 = "0pnnan9xf4r6pr34hi28zdyv501i39jwnrwk6pr9r4wabkmhb22g";
|
||||
getopt = fetchHex {
|
||||
pkg = "getopt";
|
||||
version = "0.8.2";
|
||||
sha256 = "1xw30h59zbw957cyjd8n50hf9y09jnv9dyry6x3avfwzcyrnsvkk";
|
||||
};
|
||||
bbmustache = fetchHex {
|
||||
pkg = "bbmustache";
|
||||
version = "1.3.0";
|
||||
sha256 = "042pfgss8kscq6ssg8gix8ccmdsrx0anjczsbrn2a6c36ljrx2p6";
|
||||
};
|
||||
relx = fetchHex {
|
||||
pkg = "relx";
|
||||
version = "3.21.1";
|
||||
sha256 = "00590aqy0rfzgsnzxqgwbmn90imxxqlzmnmapy6bq76vw2rynvb8";
|
||||
version = "3.23.1";
|
||||
sha256 = "13j7wds2d7b8v3r9pwy3zhwhzywgwhn6l9gm3slqzyrs1jld0a9d";
|
||||
};
|
||||
cf = fetchHex {
|
||||
pkg = "cf";
|
||||
version = "0.2.2";
|
||||
sha256 = "08cvy7skn5d2k4manlx5k3anqgjdvajjhc5jwxbaszxw34q3na28";
|
||||
};
|
||||
cth_readable = fetchHex {
|
||||
pkg = "cth_readable";
|
||||
version = "1.3.0";
|
||||
sha256 = "1s7bqj6f2zpbyjmbfq2mm6vcz1jrxjr2nd0531wshsx6fnshqhvs";
|
||||
};
|
||||
eunit_formatters = fetchHex {
|
||||
pkg = "eunit_formatters";
|
||||
version = "0.3.1";
|
||||
sha256 = "0cg9dasv60v09q3q4wja76pld0546mhmlpb0khagyylv890hg934";
|
||||
};
|
||||
rebar3_hex = fetchHex {
|
||||
pkg = "rebar3_hex";
|
||||
version = "1.12.0";
|
||||
sha256 = "45467e93ae8d776c6038fdaeaffbc55d8f2f097f300a54dab9b81c6d1cf21f73";
|
||||
version = "4.0.0";
|
||||
sha256 = "0k0ykx1lz62r03dpbi2zxsvrxgnr5hj67yky0hjrls09ynk4682v";
|
||||
};
|
||||
|
||||
in
|
||||
@ -70,22 +70,20 @@ stdenv.mkDerivation {
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/rebar/rebar3/archive/${version}.tar.gz";
|
||||
sha256 = "14nhc1bmna3b4y9qmd0lzpi0jdaw92r7ljg7vlghn297awsjgg6c";
|
||||
sha256 = "1a05gpxxc3mx5v33kzpb5xnq5vglmjl0q8hrcvpinjlazcwbg531";
|
||||
};
|
||||
|
||||
inherit bootstrapper;
|
||||
|
||||
patches = if hermeticRebar3 == true
|
||||
then [ ./hermetic-bootstrap.patch ./hermetic-rebar3.patch ]
|
||||
then [ ./hermetic-rebar3.patch ]
|
||||
else [];
|
||||
|
||||
buildInputs = [ erlang tree ];
|
||||
propagatedBuildInputs = [ hexRegistrySnapshot ];
|
||||
|
||||
postPatch = ''
|
||||
echo postPatch
|
||||
${erlang}/bin/escript ${bootstrapper} registry-only
|
||||
echo "$ERL_LIBS"
|
||||
mkdir -p _build/default/lib/
|
||||
mkdir -p _build/default/plugins
|
||||
cp --no-preserve=mode -R ${erlware_commons} _build/default/lib/erlware_commons
|
||||
|
@ -1,169 +0,0 @@
|
||||
diff --git a/bootstrap b/bootstrap
|
||||
index c36fddb..9fcb718 100755
|
||||
--- a/bootstrap
|
||||
+++ b/bootstrap
|
||||
@@ -7,9 +7,11 @@ main(_) ->
|
||||
application:start(asn1),
|
||||
application:start(public_key),
|
||||
application:start(ssl),
|
||||
- inets:start(),
|
||||
- inets:start(httpc, [{profile, rebar}]),
|
||||
- set_httpc_options(),
|
||||
+ %% Removed for hermeticity on Nix
|
||||
+ %%
|
||||
+ %% inets:start(),
|
||||
+ %% inets:start(httpc, [{profile, rebar}]),
|
||||
+ %% set_httpc_options(),
|
||||
|
||||
%% Fetch and build deps required to build rebar3
|
||||
BaseDeps = [{providers, []}
|
||||
@@ -73,13 +75,13 @@ default_registry_file() ->
|
||||
CacheDir = filename:join([Home, ".cache", "rebar3"]),
|
||||
filename:join([CacheDir, "hex", "default", "registry"]).
|
||||
|
||||
-fetch_and_compile({Name, ErlFirstFiles}, Deps) ->
|
||||
- case lists:keyfind(Name, 1, Deps) of
|
||||
- {Name, Vsn} ->
|
||||
- ok = fetch({pkg, atom_to_binary(Name, utf8), list_to_binary(Vsn)}, Name);
|
||||
- {Name, _, Source} ->
|
||||
- ok = fetch(Source, Name)
|
||||
- end,
|
||||
+fetch_and_compile({Name, ErlFirstFiles}, _Deps) ->
|
||||
+ %% case lists:keyfind(Name, 1, Deps) of
|
||||
+ %% {Name, Vsn} ->
|
||||
+ %% ok = fetch({pkg, atom_to_binary(Name, utf8), list_to_binary(Vsn)}, Name);
|
||||
+ %% {Name, _, Source} ->
|
||||
+ %% ok = fetch(Source, Name)
|
||||
+ %% end,
|
||||
|
||||
%% Hack: erlware_commons depends on a .script file to check if it is being built with
|
||||
%% rebar2 or rebar3. But since rebar3 isn't built yet it can't get the vsn with get_key.
|
||||
@@ -88,67 +90,67 @@ fetch_and_compile({Name, ErlFirstFiles}, Deps) ->
|
||||
|
||||
compile(Name, ErlFirstFiles).
|
||||
|
||||
-fetch({pkg, Name, Vsn}, App) ->
|
||||
- Dir = filename:join([filename:absname("_build/default/lib/"), App]),
|
||||
- case filelib:is_dir(Dir) of
|
||||
- false ->
|
||||
- CDN = "https://repo.hex.pm/tarballs",
|
||||
- Package = binary_to_list(<<Name/binary, "-", Vsn/binary, ".tar">>),
|
||||
- Url = string:join([CDN, Package], "/"),
|
||||
- case request(Url) of
|
||||
- {ok, Binary} ->
|
||||
- {ok, Contents} = extract(Binary),
|
||||
- ok = erl_tar:extract({binary, Contents}, [{cwd, Dir}, compressed]);
|
||||
- _ ->
|
||||
- io:format("Error: Unable to fetch package ~p ~p~n", [Name, Vsn])
|
||||
- end;
|
||||
- true ->
|
||||
- io:format("Dependency ~s already exists~n", [Name])
|
||||
- end.
|
||||
-
|
||||
-extract(Binary) ->
|
||||
- {ok, Files} = erl_tar:extract({binary, Binary}, [memory]),
|
||||
- {"contents.tar.gz", Contents} = lists:keyfind("contents.tar.gz", 1, Files),
|
||||
- {ok, Contents}.
|
||||
-
|
||||
-request(Url) ->
|
||||
- case httpc:request(get, {Url, []},
|
||||
- [{relaxed, true}],
|
||||
- [{body_format, binary}],
|
||||
- rebar) of
|
||||
- {ok, {{_Version, 200, _Reason}, _Headers, Body}} ->
|
||||
- {ok, Body};
|
||||
- Error ->
|
||||
- Error
|
||||
- end.
|
||||
-
|
||||
-get_rebar_config() ->
|
||||
- {ok, [[Home]]} = init:get_argument(home),
|
||||
- ConfDir = filename:join(Home, ".config/rebar3"),
|
||||
- case file:consult(filename:join(ConfDir, "rebar.config")) of
|
||||
- {ok, Config} ->
|
||||
- Config;
|
||||
- _ ->
|
||||
- []
|
||||
- end.
|
||||
-
|
||||
-get_http_vars(Scheme) ->
|
||||
- OS = case os:getenv(atom_to_list(Scheme)) of
|
||||
- Str when is_list(Str) -> Str;
|
||||
- _ -> []
|
||||
- end,
|
||||
- proplists:get_value(Scheme, get_rebar_config(), OS).
|
||||
-
|
||||
-set_httpc_options() ->
|
||||
- set_httpc_options(https_proxy, get_http_vars(https_proxy)),
|
||||
- set_httpc_options(proxy, get_http_vars(http_proxy)).
|
||||
-
|
||||
-set_httpc_options(_, []) ->
|
||||
- ok;
|
||||
-
|
||||
-set_httpc_options(Scheme, Proxy) ->
|
||||
- {ok, {_, _, Host, Port, _, _}} = http_uri:parse(Proxy),
|
||||
- httpc:set_options([{Scheme, {{Host, Port}, []}}], rebar).
|
||||
+%% fetch({pkg, Name, Vsn}, App) ->
|
||||
+%% Dir = filename:join([filename:absname("_build/default/lib/"), App]),
|
||||
+%% case filelib:is_dir(Dir) of
|
||||
+%% false ->
|
||||
+%% CDN = "https://repo.hex.pm/tarballs",
|
||||
+%% Package = binary_to_list(<<Name/binary, "-", Vsn/binary, ".tar">>),
|
||||
+%% Url = string:join([CDN, Package], "/"),
|
||||
+%% case request(Url) of
|
||||
+%% {ok, Binary} ->
|
||||
+%% {ok, Contents} = extract(Binary),
|
||||
+%% ok = erl_tar:extract({binary, Contents}, [{cwd, Dir}, compressed]);
|
||||
+%% _ ->
|
||||
+%% io:format("Error: Unable to fetch package ~p ~p~n", [Name, Vsn])
|
||||
+%% end;
|
||||
+%% true ->
|
||||
+%% io:format("Dependency ~s already exists~n", [Name])
|
||||
+%% end.
|
||||
+
|
||||
+%% extract(Binary) ->
|
||||
+%% {ok, Files} = erl_tar:extract({binary, Binary}, [memory]),
|
||||
+%% {"contents.tar.gz", Contents} = lists:keyfind("contents.tar.gz", 1, Files),
|
||||
+%% {ok, Contents}.
|
||||
+
|
||||
+%% request(Url) ->
|
||||
+%% case httpc:request(get, {Url, []},
|
||||
+%% [{relaxed, true}],
|
||||
+%% [{body_format, binary}],
|
||||
+%% rebar) of
|
||||
+%% {ok, {{_Version, 200, _Reason}, _Headers, Body}} ->
|
||||
+%% {ok, Body};
|
||||
+%% Error ->
|
||||
+%% Error
|
||||
+%% end.
|
||||
+
|
||||
+%% get_rebar_config() ->
|
||||
+%% {ok, [[Home]]} = init:get_argument(home),
|
||||
+%% ConfDir = filename:join(Home, ".config/rebar3"),
|
||||
+%% case file:consult(filename:join(ConfDir, "rebar.config")) of
|
||||
+%% {ok, Config} ->
|
||||
+%% Config;
|
||||
+%% _ ->
|
||||
+%% []
|
||||
+%% end.
|
||||
+
|
||||
+%% get_http_vars(Scheme) ->
|
||||
+%% OS = case os:getenv(atom_to_list(Scheme)) of
|
||||
+%% Str when is_list(Str) -> Str;
|
||||
+%% _ -> []
|
||||
+%% end,
|
||||
+%% proplists:get_value(Scheme, get_rebar_config(), OS).
|
||||
+
|
||||
+%% set_httpc_options() ->
|
||||
+%% set_httpc_options(https_proxy, get_http_vars(https_proxy)),
|
||||
+%% set_httpc_options(proxy, get_http_vars(http_proxy)).
|
||||
+
|
||||
+%% set_httpc_options(_, []) ->
|
||||
+%% ok;
|
||||
+
|
||||
+%% set_httpc_options(Scheme, Proxy) ->
|
||||
+%% {ok, {_, _, Host, Port, _, _}} = http_uri:parse(Proxy),
|
||||
+%% httpc:set_options([{Scheme, {{Host, Port}, []}}], rebar).
|
||||
|
||||
compile(App, FirstFiles) ->
|
||||
Dir = filename:join(filename:absname("_build/default/lib/"), App),
|
@ -1,22 +1,16 @@
|
||||
diff --git a/src/rebar3.erl b/src/rebar3.erl
|
||||
index 47dc25a..edda250 100644
|
||||
--- a/src/rebar3.erl
|
||||
+++ b/src/rebar3.erl
|
||||
@@ -304,9 +304,11 @@ start_and_load_apps(Caller) ->
|
||||
ensure_running(crypto, Caller),
|
||||
ensure_running(asn1, Caller),
|
||||
ensure_running(public_key, Caller),
|
||||
- ensure_running(ssl, Caller),
|
||||
- inets:start(),
|
||||
- inets:start(httpc, [{profile, rebar}]).
|
||||
+ ensure_running(ssl, Caller).
|
||||
+%% Removed due to the hermicity requirements of Nix
|
||||
+%%
|
||||
+%% inets:start(),
|
||||
+%% inets:start(httpc, [{profile, rebar}]).
|
||||
diff --git a/bootstrap b/bootstrap
|
||||
index 7c56bab..16c1be5 100755
|
||||
--- a/bootstrap
|
||||
+++ b/bootstrap
|
||||
@@ -101,7 +101,7 @@ extract(Binary) ->
|
||||
request(Url) ->
|
||||
HttpOptions = [{relaxed, true} | get_proxy_auth()],
|
||||
|
||||
ensure_running(App, Caller) ->
|
||||
case application:start(App) of
|
||||
- case httpc:request(get, {Url, []},
|
||||
+ case rebar_hermeticity:request(get, {Url, []},
|
||||
HttpOptions,
|
||||
[{body_format, binary}],
|
||||
rebar) of
|
||||
diff --git a/src/rebar_hermeticity.erl b/src/rebar_hermeticity.erl
|
||||
new file mode 100644
|
||||
index 0000000..8f6cc7d
|
||||
@ -66,23 +60,32 @@ index 0000000..8f6cc7d
|
||||
+ ?ERROR("Request: ~p ~s", [Method, Url]),
|
||||
+ erlang:halt(1).
|
||||
diff --git a/src/rebar_pkg_resource.erl b/src/rebar_pkg_resource.erl
|
||||
index 5817817..2ea1703 100644
|
||||
index d588f24..9ac8ad4 100644
|
||||
--- a/src/rebar_pkg_resource.erl
|
||||
+++ b/src/rebar_pkg_resource.erl
|
||||
@@ -107,7 +107,7 @@ make_vsn(_) ->
|
||||
{error, "Replacing version of type pkg not supported."}.
|
||||
|
||||
@@ -109,7 +109,7 @@ make_vsn(_) ->
|
||||
request(Url, ETag) ->
|
||||
HttpOptions = [{ssl, ssl_opts(Url)}, {relaxed, true} | rebar_utils:get_proxy_auth()],
|
||||
|
||||
- case httpc:request(get, {Url, [{"if-none-match", ETag} || ETag =/= false]++[{"User-Agent", rebar_utils:user_agent()}]},
|
||||
+ case rebar_hermeticity:request(get, {Url, [{"if-none-match", ETag} || ETag =/= false]++[{"User-Agent", rebar_utils:user_agent()}]},
|
||||
[{ssl, ssl_opts(Url)}, {relaxed, true}],
|
||||
HttpOptions,
|
||||
[{body_format, binary}],
|
||||
rebar) of
|
||||
diff --git a/src/rebar_prv_update.erl b/src/rebar_prv_update.erl
|
||||
index 75c609e..4283c23 100644
|
||||
index a019c5a..697cbab 100644
|
||||
--- a/src/rebar_prv_update.erl
|
||||
+++ b/src/rebar_prv_update.erl
|
||||
@@ -52,7 +52,7 @@ do(State) ->
|
||||
@@ -38,6 +38,8 @@ init(State) ->
|
||||
{ok, State1}.
|
||||
|
||||
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
|
||||
+do(State) -> {ok, State}.
|
||||
+-ifdef(non_hermetic).
|
||||
do(State) ->
|
||||
try
|
||||
case rebar_packages:registry_dir(State) of
|
||||
@@ -52,7 +54,7 @@ do(State) ->
|
||||
case rebar_utils:url_append_path(CDN, ?REMOTE_REGISTRY_FILE) of
|
||||
{ok, Url} ->
|
||||
?DEBUG("Fetching registry from ~p", [Url]),
|
||||
@ -91,3 +94,11 @@ index 75c609e..4283c23 100644
|
||||
[], [{stream, TmpFile}, {sync, true}],
|
||||
rebar) of
|
||||
{ok, saved_to_file} ->
|
||||
@@ -76,6 +78,7 @@ do(State) ->
|
||||
?DEBUG("Error creating package index: ~p ~p", [C, erlang:get_stacktrace()]),
|
||||
throw(?PRV_ERROR(package_index_write))
|
||||
end.
|
||||
+-endif.
|
||||
|
||||
-spec format_error(any()) -> iolist().
|
||||
format_error({package_parse_cdn, Uri}) ->
|
||||
|
@ -94,7 +94,7 @@ bootstrap_plugins(#data{plugins = Plugins}) ->
|
||||
|
||||
-spec bootstrap_libs(#data{}) -> ok.
|
||||
bootstrap_libs(#data{erl_libs = ErlLibs}) ->
|
||||
io:format("Bootstrapping dependent librariesXXXX~n"),
|
||||
io:format("Bootstrapping dependent libraries~n"),
|
||||
Target = "_build/default/lib/",
|
||||
Paths = string:tokens(ErlLibs, ":"),
|
||||
CopiableFiles =
|
||||
|
@ -1,19 +1,34 @@
|
||||
{stdenv, fetchFromGitHub, buildRebar3, ibrowse, jsx, erlware_commons, getopt }:
|
||||
{ stdenv, fetchFromGitHub, buildRebar3, buildHex
|
||||
|
||||
, getopt_0_8_2, erlware_commons_1_0_0 }:
|
||||
|
||||
let
|
||||
ibrowse_4_4_0 = buildHex {
|
||||
name = "ibrowse";
|
||||
version = "4.4.0";
|
||||
sha256 = "1hpic1xgksfm00mbl1kwmszca6jmjca32s7gdd8g11i0hy45k3ka";
|
||||
};
|
||||
jsx_2_8_2 = buildHex {
|
||||
name = "jsx";
|
||||
version = "2.8.2";
|
||||
sha256 = "0k7lnmwqbgpmh90wy30kc0qlddkbh9r3sjlyayaqsz1r1cix7idl";
|
||||
};
|
||||
|
||||
in
|
||||
buildRebar3 rec {
|
||||
name = "hex2nix";
|
||||
version = "0.0.5";
|
||||
version = "0.0.6";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "erlang-nix";
|
||||
repo = "hex2nix";
|
||||
rev = "${version}";
|
||||
sha256 = "07bk18nib4xms8q1i4sv53drvlyllm47map4c95669lsh0j08sax";
|
||||
sha256 = "17rkzg836v7z2xf0i5m8zqfvr23dbmw1bi3c83km92f9glwa1dbf";
|
||||
};
|
||||
|
||||
beamDeps = [ ibrowse jsx erlware_commons getopt ];
|
||||
beamDeps = [ ibrowse_4_4_0 jsx_2_8_2 erlware_commons_1_0_0 getopt_0_8_2 ];
|
||||
|
||||
DEBUG=1;
|
||||
enableDebugInfo = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
@ -1,38 +1,49 @@
|
||||
{ stdenv, beamPackages, makeWrapper, fetchHex, erlang }:
|
||||
beamPackages.buildRebar3 {
|
||||
name = "relx-exe";
|
||||
version = "3.18.0";
|
||||
src = fetchHex {
|
||||
pkg = "relx";
|
||||
version = "3.18.0";
|
||||
sha256 =
|
||||
"e76e0446b8d1b113f2b7dcc713f032ccdf1dbda33d76edfeb19c2b6b686dcad7";
|
||||
};
|
||||
{ stdenv, beamPackages, buildRebar3, buildHex, fetchHex
|
||||
|
||||
buildInputs = [ makeWrapper erlang ];
|
||||
, getopt_0_8_2, erlware_commons_1_0_0, cf_0_2_2 }:
|
||||
|
||||
beamDeps = with beamPackages; [
|
||||
providers_1_6_0
|
||||
getopt_0_8_2
|
||||
erlware_commons_0_19_0
|
||||
cf_0_2_1
|
||||
bbmustache_1_0_4
|
||||
];
|
||||
let
|
||||
providers_1_6_0 = buildHex {
|
||||
name = "providers";
|
||||
version = "1.6.0";
|
||||
sha256 = "0byfa1h57n46jilz4q132j0vk3iqc0v1vip89li38gb1k997cs0g";
|
||||
beamDeps = [ getopt_0_8_2 ];
|
||||
};
|
||||
bbmustache_1_0_4 = buildHex {
|
||||
name = "bbmustache";
|
||||
version = "1.0.4";
|
||||
sha256 = "04lvwm7f78x8bys0js33higswjkyimbygp4n72cxz1kfnryx9c03";
|
||||
};
|
||||
|
||||
postBuild = ''
|
||||
HOME=. rebar3 escriptize
|
||||
'';
|
||||
in
|
||||
buildHex rec {
|
||||
name = "relx-exe";
|
||||
version = "3.23.1";
|
||||
hexPkg = "relx";
|
||||
sha256 = "13j7wds2d7b8v3r9pwy3zhwhzywgwhn6l9gm3slqzyrs1jld0a9d";
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p "$out/bin"
|
||||
cp -r "_build/default/bin/relx" "$out/bin/relx"
|
||||
'';
|
||||
beamDeps = [
|
||||
providers_1_6_0
|
||||
getopt_0_8_2
|
||||
erlware_commons_1_0_0
|
||||
cf_0_2_2
|
||||
bbmustache_1_0_4
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "Executable command for Relx";
|
||||
license = stdenv.lib.licenses.asl20;
|
||||
homepage = https://github.com/erlware/relx;
|
||||
maintainers = with stdenv.lib.maintainers; [ ericbmerritt ];
|
||||
};
|
||||
postBuild = ''
|
||||
HOME=. rebar3 escriptize
|
||||
'';
|
||||
|
||||
}
|
||||
postInstall = ''
|
||||
mkdir -p "$out/bin"
|
||||
cp -r "_build/default/bin/relx" "$out/bin/relx"
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Executable command for Relx";
|
||||
license = stdenv.lib.licenses.asl20;
|
||||
homepage = "https://github.com/erlware/relx";
|
||||
maintainers = with stdenv.lib.maintainers; [ ericbmerritt ];
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user