Skip to content

Commit 17c41db

Browse files
authored
fix: nix build (#247)
1 parent 8a151e1 commit 17c41db

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

flake.lock

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+5-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
mixFodDeps = beamPackages.fetchMixDeps {
6060
inherit src version;
6161
pname = "${pname}-deps";
62-
hash = "sha256-jUkz/pu3iyizpHkMYgmbYfalFv10t11b6SmLVEXAJ30=";
62+
hash = "sha256-sRve0L7qFw5vEsespIXVg4loSej+oLO1ewdmT6qGExw=";
6363
};
6464

6565
preConfigure = ''
@@ -73,6 +73,10 @@
7373
export PATH="$bindir:$PATH"
7474
'';
7575

76+
preBuild = ''
77+
export BURRITO_ERTS_PATH=${beamPackages.erlang}/lib/erlang
78+
'';
79+
7680
preInstall =
7781
if type == "local" then ''
7882
export BURRITO_TARGET="${burritoExe(system)}"

mix.exs

+17-2
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ defmodule NextLS.MixProject do
4040
next_ls: [
4141
steps: [:assemble, &Burrito.wrap/1],
4242
burrito: [
43-
targets: [
43+
targets: inject_custom_erts([
4444
darwin_arm64: [os: :darwin, cpu: :aarch64],
4545
darwin_amd64: [os: :darwin, cpu: :x86_64],
4646
linux_arm64: [os: :linux, cpu: :aarch64, libc: :gnu],
4747
linux_amd64: [os: :linux, cpu: :x86_64, libc: :gnu],
4848
linux_arm64_musl: [os: :linux, cpu: :aarch64, libc: :musl],
4949
linux_amd64_musl: [os: :linux, cpu: :x86_64, libc: :musl],
5050
windows_amd64: [os: :windows, cpu: :x86_64]
51-
]
51+
])
5252
]
5353
]
5454
]
@@ -84,4 +84,19 @@ defmodule NextLS.MixProject do
8484
files: ~w(lib LICENSE mix.exs priv README.md .formatter.exs)
8585
]
8686
end
87+
88+
defp inject_custom_erts(targets) do
89+
# By default, Burrito downloads ERTS from https://burrito-otp.b-cdn.net.
90+
# When building with Nix, side-effects like network access are not allowed,
91+
# so we need to inject our own ERTS path.
92+
93+
erts_path = System.get_env("BURRITO_ERTS_PATH", "")
94+
95+
Enum.map(targets, fn {target_name, target_conf} ->
96+
case erts_path do
97+
"" -> {target_name, target_conf}
98+
path -> {target_name, [{:custom_erts, path} | target_conf]}
99+
end
100+
end)
101+
end
87102
end

mix.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
%{
2-
"burrito": {:git, "https://github.com/burrito-elixir/burrito.git", "5c7b29811279f3272005534a3fec29a687e9b6bf", []},
2+
"burrito": {:git, "https://github.com/burrito-elixir/burrito.git", "a86857636eaba9a7fa179fd970ed6cf82e9e7d59", []},
33
"bypass": {:hex, :bypass, "2.1.0", "909782781bf8e20ee86a9cabde36b259d44af8b9f38756173e8f5e2e1fabb9b1", [:mix], [{:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: false]}, {:ranch, "~> 1.3", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "d9b5df8fa5b7a6efa08384e9bbecfe4ce61c77d28a4282f79e02f1ef78d96b80"},
44
"castore": {:hex, :castore, "1.0.3", "7130ba6d24c8424014194676d608cb989f62ef8039efd50ff4b3f33286d06db8", [:mix], [], "hexpm", "680ab01ef5d15b161ed6a95449fac5c6b8f60055677a8e79acf01b27baa4390b"},
55
"cc_precompiler": {:hex, :cc_precompiler, "0.1.8", "933a5f4da3b19ee56539a076076ce4d7716d64efc8db46fd066996a7e46e2bfd", [:mix], [{:elixir_make, "~> 0.7.3", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "176bdf4366956e456bf761b54ad70bc4103d0269ca9558fd7cee93d1b3f116db"},

0 commit comments

Comments
 (0)