From patchwork Sun Dec 8 22:03:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Kubisiak X-Patchwork-Id: 34661 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 4847127BBE2; Sun, 8 Dec 2024 22:04:26 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 4CCD827BBE9 for ; Sun, 8 Dec 2024 22:04:24 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKPNk-0001wl-Kt; Sun, 08 Dec 2024 17:04:04 -0500 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 1tKPNi-0001wc-Tb for guix-patches@gnu.org; Sun, 08 Dec 2024 17:04:03 -0500 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 1tKPNi-0001jz-Ko for guix-patches@gnu.org; Sun, 08 Dec 2024 17:04:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:From:Date:To:In-Reply-To:References:Subject; bh=uTDgIeei+nonM3f78WhRKqXuUHtju5VaSw4vGHPL6ro=; b=atOYO8htYGBmdjWTK1FrPhKSSKI6Y1YZKvbBkO0hKzFRm0FRWvFdCv1aaOtZ0DfL92qJDByEX9fH+ScFhLT8FQDctMRaCl7rOFul/+NXomCBAFPC5pGBx/10Un8ns3SvqoOQwlLGTaXJLEraUKa9Insx8rtX9kIKZ09TFJ7p7AWUgZ4/OR7iXfZqkLdOWIjgX6RfJ7IJICvl2jNMHHZugN4liMuYeJws96oX4DzC6AprEh+NVMVsfH08Wf2CERALT94UftHYjrUWa/I+VUHd81wr3ey1TW0rLcLUJdHDOOvEDsOJNfARsf20Rt5W+GnvO1F9vLro0fhcU29ziN5O9A==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tKPNi-0001zn-3f for guix-patches@gnu.org; Sun, 08 Dec 2024 17:04:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74633] [PATCH v2] ui: Search channels for guix extensions References: <2fc5afe876af28643f8074dd1623640cb314cc5e.1733064752.git.brian@kubisiak.com> In-Reply-To: <2fc5afe876af28643f8074dd1623640cb314cc5e.1733064752.git.brian@kubisiak.com> Resent-From: Brian Kubisiak Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 08 Dec 2024 22:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74633 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74633@debbugs.gnu.org Received: via spool by 74633-submit@debbugs.gnu.org id=B74633.17336954377655 (code B ref 74633); Sun, 08 Dec 2024 22:04:02 +0000 Received: (at 74633) by debbugs.gnu.org; 8 Dec 2024 22:03:57 +0000 Received: from localhost ([127.0.0.1]:51920 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKPNd-0001zO-0a for submit@debbugs.gnu.org; Sun, 08 Dec 2024 17:03:57 -0500 Received: from [75.171.110.13] (port=1859 helo=mail.kubisiak.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKPNa-0001z1-T4 for 74633@debbugs.gnu.org; Sun, 08 Dec 2024 17:03:55 -0500 dkim-signature: v=1; a=rsa-sha256; d=kubisiak.com; s=s1; c=relaxed/relaxed; q=dns/txt; h=From:Subject:Date:Message-ID:To:MIME-Version:Content-Type; bh=uTDgIeei+nonM3f78WhRKqXuUHtju5VaSw4vGHPL6ro=; b=KKW/SlDkCd1eCzCTFwwWWuQkaW46aMmY+g0J5mrk40rc0fDn2BeM4wB2DO/wBIRCDvEJav/uODAGENHfHzvFHvKU2tBasJY0dNMPk+2KfDQ306UI/NY3ly85FwA4kRM5vRRh3ws5zRGNlTVIhIhWBZd9TN10qFrDkBO8wJHpv1Qa4mQPKsIsINMsIK6pgKTLRHuAAmmPXGogAxnUsaDDozji2eg4c3ZkjZihQIvjW2JCJSKTBWqwuvLEYQ /12dr1sZpK3Jtua2zvkqMWFER5mSF/yXHLqwzLm7sy35N0vn9mh6ubiEcjGFyNVhqY/NKuQtndp2YqM0jjKnqbkdxh2g== Received: from peregrine (135-180-130-213.dsl.dynamic.sonic.net [135.180.130.213]) (envelope-sender ) by mail.kubisiak.com with ESMTPSA id <2c078699007e847611b7a20679621813691d9db3.1733695255.git.brian@kubisiak.com> for <74633@debbugs.gnu.org> (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256) ; Sun, 8 Dec 2024 16:03:46 -0600 Date: Sun, 8 Dec 2024 14:03:45 -0800 From: Brian Kubisiak Message-ID: <2c078699007e847611b7a20679621813691d9db3.1733695255.git.brian@kubisiak.com> MIME-Version: 1.0 Content-Disposition: inline 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/describe.scm (add-channels-to-load-path!): New function. * gnu/packages.scm (%package-module-path): Call new function. Remove the code that the function call replaces. * guix/ui.scm (extension-directories): Call new function. Search channels for guix extensions. * guix/self.scm (compiled-guix)[*core-modules*]: Add 'guile-git' to the list of extensions. Change-Id: I53af828dc554485ca28389c9e2653ea6b4fb6b7e --- gnu/packages.scm | 7 ++++--- guix/describe.scm | 17 +++++++++++++++++ guix/self.scm | 1 + guix/ui.scm | 12 +++++++++--- 4 files changed, 31 insertions(+), 6 deletions(-) base-commit: 9001514e242ad15c190588439930b0fa4f6782e3 prerequisite-patch-id: cd0707c90e1d321f3f16f2f861313dd330e9f0b4 -- 2.46.0 diff --git a/gnu/packages.scm b/gnu/packages.scm index 1af3b8d440..42f3546606 100644 --- a/gnu/packages.scm +++ b/gnu/packages.scm @@ -148,15 +148,16 @@ (define %package-module-path (let* ((not-colon (char-set-complement (char-set #\:))) (environment (string-tokenize (or (getenv "GUIX_PACKAGE_PATH") "") not-colon)) - (channels-scm channels-go (package-path-entries))) + (channels-scm (package-path-entries))) ;; Automatically add channels and items from $GUIX_PACKAGE_PATH to Guile's ;; search path. For historical reasons, $GUIX_PACKAGE_PATH goes to the ;; front; channels go to the back so that they don't override Guix' own ;; modules. + (add-channels-to-load-path!) (set! %load-path - (append environment %load-path channels-scm)) + (append environment %load-path)) (set! %load-compiled-path - (append environment %load-compiled-path channels-go)) + (append environment %load-compiled-path)) (make-parameter (append environment diff --git a/guix/describe.scm b/guix/describe.scm index a4ca2462f4..6694b1eaf7 100644 --- a/guix/describe.scm +++ b/guix/describe.scm @@ -27,6 +27,7 @@ (define-module (guix describe) sexp->channel manifest-entry-channel) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-11) #:use-module (srfi srfi-34) #:use-module (ice-9 match) #:export (current-profile @@ -34,6 +35,7 @@ (define-module (guix describe) current-profile-entries current-channels package-path-entries + add-channels-to-load-path! package-provenance package-channels @@ -190,6 +192,21 @@ (define (package-path-entries) "/site-ccache"))) (current-channel-entries)))) +(define add-channels-to-load-path! + (let ((promise + (delay + (let-values (((channels-scm channels-go) (package-path-entries))) + (set! %load-path + (append %load-path channels-scm)) + (set! %load-compiled-path + (append %load-compiled-path channels-go)))))) + (lambda () + "Automatically add channels to Guile's search path. Channels are added +to the end of the path so they don't override Guix' own modules. This +function ensures that channels are only added to the search path once even if +it is called multiple times." + (force promise)))) + (define (package-channels package) "Return the list of channels providing PACKAGE or an empty list if it could not be determined." diff --git a/guix/self.scm b/guix/self.scm index 2652688c71..28239d53f5 100644 --- a/guix/self.scm +++ b/guix/self.scm @@ -882,6 +882,7 @@ (define* (compiled-guix source #:key ,(local-file "../guix/store/schema.sql"))) #:extensions (list guile-gcrypt + guile-git ;for (guix git) guile-json) ;for (guix swh) #:guile-for-build guile-for-build)) diff --git a/guix/ui.scm b/guix/ui.scm index eba12c8616..87ae24ea55 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -38,6 +38,7 @@ (define-module (guix ui) ;import in user interfaces only #:use-module (guix i18n) #:use-module (guix colors) + #:use-module (guix describe) #:use-module (guix diagnostics) #:use-module (guix gexp) #:use-module (guix sets) @@ -2192,9 +2193,14 @@ (define* (command-files #:optional directory) (define (extension-directories) "Return the list of directories containing Guix extensions." - (filter file-exists? - (parse-path - (getenv "GUIX_EXTENSIONS_PATH")))) + (add-channels-to-load-path!) + (let ((channels (package-path-entries))) + (filter file-exists? + (parse-path + (getenv "GUIX_EXTENSIONS_PATH") + (map + (cut string-append <> "/guix/extensions") + channels))))) (define (commands) "Return the list of commands, alphabetically sorted."