guix_mirror_bot pushed a commit to branch beam-team
in repository guix.
commit f1d277707cd8913815d0672bae695c723caa898f
Author: Igorj Gorjaĉev <[email protected]>
AuthorDate: Wed Oct 22 01:36:34 2025 +0300
gnu: elixir: Add vendoring support.
* gnu/packages/elixir.scm (elixir): Add vendoring support.
* gnu/packages/patches/elixir-vendoring-support.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
Change-Id: Id295ac66684c724ac799878ec58d84617bf9a5be
Signed-off-by: Giacomo Leidi <[email protected]>
---
gnu/local.mk | 1 +
gnu/packages/elixir.scm | 3 +-
.../patches/elixir-vendoring-support.patch | 56 ++++++++++++++++++++++
3 files changed, 59 insertions(+), 1 deletion(-)
diff --git a/gnu/local.mk b/gnu/local.mk
index fd063ec5f1..60b1020b91 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1222,6 +1222,7 @@ dist_patch_DATA =
\
%D%/packages/patches/elfutils-tests-ptrace.patch \
%D%/packages/patches/elixir-httpoison-tag-network-dependent-test-cases.patch
\
%D%/packages/patches/elixir-path-length.patch \
+ %D%/packages/patches/elixir-vendoring-support.patch \
%D%/packages/patches/elm-ghc9.2.patch \
%D%/packages/patches/python-treelib-remove-python2-compat.patch \
%D%/packages/patches/elm-offline-package-registry.patch \
diff --git a/gnu/packages/elixir.scm b/gnu/packages/elixir.scm
index 7e02971c93..ee372e1a64 100644
--- a/gnu/packages/elixir.scm
+++ b/gnu/packages/elixir.scm
@@ -51,7 +51,8 @@
(file-name (git-file-name name version))
(sha256
(base32 "1i10a5d7mlcrav47k7qirqvrqn2kbl5265fbcp8fzavr86xz67m6"))
- (patches (search-patches "elixir-path-length.patch"))))
+ (patches (search-patches "elixir-path-length.patch"
+ "elixir-vendoring-support.patch"))))
(build-system gnu-build-system)
(arguments
(list
diff --git a/gnu/packages/patches/elixir-vendoring-support.patch
b/gnu/packages/patches/elixir-vendoring-support.patch
new file mode 100644
index 0000000000..c8b8f41be2
--- /dev/null
+++ b/gnu/packages/patches/elixir-vendoring-support.patch
@@ -0,0 +1,56 @@
+Author: Igorj Gorjaĉev <[email protected]>
+Date: Wed Oct 22 10:10:13 2025 +0300
+
+ vendoring support for guix
+
+diff --git a/lib/mix/lib/mix/dep/loader.ex b/lib/mix/lib/mix/dep/loader.ex
+index e47bfc556..0ddd49fe5 100644
+--- a/lib/mix/lib/mix/dep/loader.ex
++++ b/lib/mix/lib/mix/dep/loader.ex
+@@ -198,6 +198,10 @@ defp with_scm_and_app(app, req, opts, original, locked?)
do
+ )
+ end
+
++ scm = Mix.Guix.scm(scm)
++ req = Mix.Guix.req(req)
++ opts = Mix.Guix.opts(opts, app)
++
+ %Mix.Dep{
+ scm: scm,
+ app: app,
+diff --git a/lib/mix/lib/mix/guix.ex b/lib/mix/lib/mix/guix.ex
+new file mode 100644
+index 000000000..9c821704c
+--- /dev/null
++++ b/lib/mix/lib/mix/guix.ex
+@@ -0,0 +1,30 @@
++defmodule Mix.Guix do
++ @moduledoc false
++
++ @guix_vendorize "GUIX_MIX_VENDOR_DIR"
++
++ def scm(scm), do: (vendorize?() && Mix.SCM.Path) || scm
++
++ def req(req), do: (vendorize?() && nil) || req
++
++ def opts(opts, app) do
++ if vendorize?() do
++ if Keyword.has_key?(opts, :path) do
++ opts
++ else
++ dep_dir = vendor_dep_dir(app)
++
++ [path: dep_dir, dest: dep_dir] ++
++ Keyword.drop(opts, [:hex, :override, :repo, :lock, :dest])
++ end
++ else
++ opts
++ end
++ end
++
++ defp vendorize?, do: not is_nil(vendor_dir())
++
++ defp vendor_dir, do: System.get_env(@guix_vendorize)
++
++ defp vendor_dep_dir(name), do: "#{vendor_dir()}/#{name}"
++end