From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id QDPdJx/J82Yc5QAA62LTzQ:P1 (envelope-from ) for ; Wed, 25 Sep 2024 08:26:07 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id QDPdJx/J82Yc5QAA62LTzQ (envelope-from ) for ; Wed, 25 Sep 2024 10:26:07 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=FX3Y4RfK; dkim=fail ("headers rsa verify failed") header.d=autistici.org header.s=stigmate header.b=GZjISEXZ; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1727252767; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=dmUfTgj4jlTzjZv9WPEbEAZwBXjrc6L3ydRkFUAtMNA=; b=RqbyR0Ioq5mjpCH7Lpb2MFPwCIzwFaEVlZ5sDF+2hRtW3n4eFDbFVmznPyLv6+p+wYJAC4 5G607kZxIka9bN0vDovOXzx6FSz6sKpN8ecU6QNdcBcX4P0iSgfRZLXttcNeVeewvLqFCH SEo1TtUBmvf/7EO/V2umxODR6HhzTtYFhDoiPTtHM9sNtRvoP1GRZpOVr1HJQN5fKxS4By 6cPsPK4Cu0H3WkKVX7hPvB9QvkPH1mO7p/oJUv5CyM5xuLSPmKj2R1S7M8D+OkY6fCH9lX 25YjUgRsYM1DfuNOdpLXPHD2iuCtLLm83169n0Z6jAF+v1/3Z4d3EGbvcA6aNA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1727252767; a=rsa-sha256; cv=none; b=ue2bSEkhf/0lpaXhBDq6pnkHkwTGI75invzMAnKRDMwCoBJ+kzpXNSznEEy3H3NUaQdk6n PR25YJPyerFNB/L4nH6WwXmcuRI6Fm2QmbM94y3gAjTsCh+YOkSkhhaw6EGPVi0ZJznRB0 UJrd/zuDJl1dKBN2sz4oowMAM8PskzDE7VxS/tX89PZKnmaIGX/Xv+Hf2uIOm1H0Q/fGg/ Xd3u1H7KBt/ZaGHfzeubtjAcByFn8Re3c6bLGuipyxfO9bsV8vQM4lTyZMcJlNHbDN8b1y HOFnz5lo/F67HiYsMtJVeWzj9G4TPXBYKh/g9v65Oc7hR9ekSpEmU8o3/69cKw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=FX3Y4RfK; dkim=fail ("headers rsa verify failed") header.d=autistici.org header.s=stigmate header.b=GZjISEXZ; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 64C8D1C33C for ; Wed, 25 Sep 2024 10:26:07 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stNLE-0004qC-GT; Wed, 25 Sep 2024 04:25:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1stNL7-0004pP-7p for guix-patches@gnu.org; Wed, 25 Sep 2024 04:25:37 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1stNL6-0007TQ-JM for guix-patches@gnu.org; Wed, 25 Sep 2024 04:25:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:In-Reply-To:References:Subject; bh=dmUfTgj4jlTzjZv9WPEbEAZwBXjrc6L3ydRkFUAtMNA=; b=FX3Y4RfKef940SrgLWOuc8B+axeXb1z35gL8+HlWhBy5AnwvLqxdt74JADEfIHOAKZQasFkfC5nmrF+GbbP0wXddgYGILQjSSRWguA1/8uH1k209HjiuRh+5aKLYaxCq0B2HiWuzmCeGPHiij367tgy5PLhjiiEDaL2kZnDvHPPukhOmXz9e2wJm4KfSAZB2SArUaID33OWnCPPMoFXS0h/W9IOY79TDuqUsu6Ad4HdnDxnO4HmCyvSdIYkYm75I9UzW1UJg8NuZIRlvLm8WZ1JTspuSIWzYgQM+/qbZfgqw6OuDOcVHP9zJ6BRqt5z7kwmI0BHIaEiafABs2f6IGw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1stNLW-0005UH-1q for guix-patches@gnu.org; Wed, 25 Sep 2024 04:26:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73458] [PATCH 1/2] build-system: mix: Allow loading Erlang dependencies in Mix driven builds. References: In-Reply-To: Resent-From: Giacomo Leidi Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 25 Sep 2024 08:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73458 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 73458@debbugs.gnu.org Cc: Giacomo Leidi Received: via spool by 73458-submit@debbugs.gnu.org id=B73458.172725272220452 (code B ref 73458); Wed, 25 Sep 2024 08:26:02 +0000 Received: (at 73458) by debbugs.gnu.org; 25 Sep 2024 08:25:22 +0000 Received: from localhost ([127.0.0.1]:45989 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stNKr-0005Jn-Df for submit@debbugs.gnu.org; Wed, 25 Sep 2024 04:25:21 -0400 Received: from confino.investici.org ([93.190.126.19]:37685) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stNKo-0005JU-FN for 73458@debbugs.gnu.org; Wed, 25 Sep 2024 04:25:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1727252691; bh=dmUfTgj4jlTzjZv9WPEbEAZwBXjrc6L3ydRkFUAtMNA=; h=From:To:Cc:Subject:Date:From; b=GZjISEXZuuzBQ/5q0yRWw+loO3uZj7FErqT2CAvqmMAPXarI1wmYmEmCepiR9JKv4 V+j60KYgcg/DNLAZi8L8bdd6T+Z+3ydahmpD6E8YdFtF93YeXTM3/lMHs+lZZOZ4s9 7+ZuoOHilqHjVMk1eevVoAIIwatHg20b+YuTJDhc= Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4XD8sv0xmPz117g; Wed, 25 Sep 2024 08:24:51 +0000 (UTC) Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4XD8sv00f0z10yS; Wed, 25 Sep 2024 08:24:50 +0000 (UTC) Date: Wed, 25 Sep 2024 10:24:32 +0200 Message-ID: <58afb3593e28f5f670b2be516a165b59e2665276.1727252673.git.goodoldpaul@autistici.org> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Giacomo Leidi X-ACL-Warn: , Giacomo Leidi via Guix-patches From: Giacomo Leidi via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -7.12 X-Migadu-Queue-Id: 64C8D1C33C X-Spam-Score: -7.12 X-TUID: lCPi5DRpGk1c Fixes * guix/build/mix-build-system.scm (elixir-relative-libdir): New variable; (elixir-libdir): call elixir-relative-libdir; (set-erl-env): this new phase sets ERL_LIBS to allow Erlang's virtual machine to load Erlang dependencies in Mix builds, in addition to Elixir ones; (%standard-phases): add set-erl-env phases. Change-Id: Ic1ef5db20680bfd265fbac72bafb760d21135f68 --- guix/build/mix-build-system.scm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/guix/build/mix-build-system.scm b/guix/build/mix-build-system.scm index 0b021da791..41f6061444 100644 --- a/guix/build/mix-build-system.scm +++ b/guix/build/mix-build-system.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2023 Pierre-Henry Fröhring ;;; Copyright © 2024 Igor Goryachev +;;; Copyright © 2024 Giacomo Leidi ;;; ;;; This file is part of GNU Guix. ;;; @@ -39,10 +40,15 @@ (define-module (guix build mix-build-system) ;; minor version number of the Elixir used in the build. (define %elixir-version (make-parameter "X.Y")) +(define (elixir-relative-libdir version) + "Return the relative path inside a package namespace in the store where all +libraries for a specified Elixir VERSION are installed." + (string-append "lib/elixir/" version)) + (define* (elixir-libdir path #:optional (version (%elixir-version))) "Return the path where all libraries under PATH for a specified Elixir VERSION are installed." - (string-append path "/lib/elixir/" version)) + (string-append path "/" (elixir-relative-libdir version))) (define* (strip-prefix name #:optional (prefix "elixir-")) "Return NAME without the prefix PREFIX." @@ -94,6 +100,17 @@ (define* (set-mix-env #:key inputs mix-path mix-exs #:allow-other-keys) (setenv "MIX_PATH" (or mix-path "")) (setenv "MIX_REBAR3" (string-append (assoc-ref inputs "rebar3") "/bin/rebar3"))) +(define* (set-erl-env #:key inputs #:allow-other-keys) + "Add dependencies in Elixir's load path." + (setenv "ERL_LIBS" + (string-join (search-path-as-list + `("lib/erlang/lib" + ,(elixir-relative-libdir (elixir-version inputs))) + (map (match-lambda + ((label . package) package)) + inputs)) + ":"))) + (define* (set-elixir-version #:key inputs #:allow-other-keys) "Store the version number of the Elixir input in a parameter." (%elixir-version (elixir-version inputs)) @@ -152,6 +169,7 @@ (define %standard-phases (delete 'configure) (add-after 'install-locale 'set-mix-env set-mix-env) (add-after 'set-mix-env 'set-elixir-version set-elixir-version) + (add-after 'set-elixir-version 'set-erl-env set-erl-env) (replace 'unpack unpack) (replace 'build build) (replace 'check check) base-commit: 3ac69c1a757430d6dfdd37eb948ba1d6967967cc -- 2.46.0