From patchwork Sun Dec 1 14:53:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Kubisiak X-Patchwork-Id: 34351 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 AA9E827BBE9; Sun, 1 Dec 2024 14:54:37 +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 AA94B27BBE2 for ; Sun, 1 Dec 2024 14:54:34 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tHlKt-0007U8-Ok; Sun, 01 Dec 2024 09:54:11 -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 1tHlKm-0007TP-8S for guix-patches@gnu.org; Sun, 01 Dec 2024 09:54:04 -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 1tHlKk-0000LB-B6 for guix-patches@gnu.org; Sun, 01 Dec 2024 09:54:04 -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:Subject; bh=nrO2vr/Pk5PuR7Kjx3xqqcaJLkGHlwfbG8PtNeOprIU=; b=dztrdnN1aZTvio7M0ZRHHIkAM7CZk9qwWgwT5HluXJYmWZxpBRx2Rn4dYvd3rucMgBDxlgDNEHj3Rujr1Yx8mRfspK+H5DBIA81T6wkhKwaNfHm1UCfsKzf8kvldALl+QC4ngcrui8C/REWJP65xedc1dKPGAiUuxRlb3ZbWrPvhHS2BNwNJ9m0pwrQ+EW7oKBuLlFacZcossqHWq3zIBNUzlKYXsPKbQup9FcSxaDGmCHrAyLpjghVfz+9dUoWaqTBFBFJTXoADwbkEVxJ3GtZOr+8XuYzMOxzIGq38nB3XGFHL96xBg+7loZW6hI/vo7FwYzjLW46qO3QXCAZPHg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tHlKk-0005Ra-5a for guix-patches@gnu.org; Sun, 01 Dec 2024 09:54:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74633] [PATCH] ui: Search channels for guix extensions Resent-From: Brian Kubisiak Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 01 Dec 2024 14:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74633 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74633@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.173306479220835 (code B ref -1); Sun, 01 Dec 2024 14:54:01 +0000 Received: (at submit) by debbugs.gnu.org; 1 Dec 2024 14:53:12 +0000 Received: from localhost ([127.0.0.1]:50819 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHlJv-0005Py-FL for submit@debbugs.gnu.org; Sun, 01 Dec 2024 09:53:11 -0500 Received: from lists.gnu.org ([209.51.188.17]:49714) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHlJt-0005Pr-RH for submit@debbugs.gnu.org; Sun, 01 Dec 2024 09:53:10 -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 1tHlJt-0007Qy-Eq for guix-patches@gnu.org; Sun, 01 Dec 2024 09:53:09 -0500 Received: from [75.171.110.13] (helo=mail.kubisiak.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tHlJr-0008S9-KO for guix-patches@gnu.org; Sun, 01 Dec 2024 09:53:09 -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=nrO2vr/Pk5PuR7Kjx3xqqcaJLkGHlwfbG8PtNeOprIU=; b=HbnQkUjCELP/q+pPQOpqyPxe7MrYt2Oka7xD5wOJQQv5I6VTmqt3Maq9VyrXcUdnTfDVc5lyYZBx6cm0ntJsUaP6IC5x0fKHBnjNu3RCu5WL30jD77AQqbCgnJx9XkQACtwa8pVu/lCc+YZczj1UA/4XnTFDNNgH6Lpq0QpcY2DGE5+bKzRvZZxmjvoGvQuRKkbMvk4TypPAlPQXhMsL6plg2cyQSCU1wKgxXb4YOEBnaotaDDrNXPlnNo pBnj4DmaWWDB992fPVA9lzVZ49suI77wWKRLXSZLxS7Ke81MD+kOuTyg5RiCjKGuIsHf/6+g/CW2WMxjeAVWmEdZoIwg== Received: from peregrine (135-180-130-213.dsl.dynamic.sonic.net [135.180.130.213]) (envelope-sender ) by mail.kubisiak.com with ESMTPSA id <2fc5afe876af28643f8074dd1623640cb314cc5e.1733064752.git.brian@kubisiak.com> for (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256) ; Sun, 1 Dec 2024 08:53:04 -0600 Date: Sun, 1 Dec 2024 06:53:03 -0800 From: Brian Kubisiak Message-ID: <2fc5afe876af28643f8074dd1623640cb314cc5e.1733064752.git.brian@kubisiak.com> MIME-Version: 1.0 Content-Disposition: inline X-Host-Lookup-Failed: Reverse DNS lookup failed for 75.171.110.13 (failed) Received-SPF: pass client-ip=75.171.110.13; envelope-from=brian@kubisiak.com; helo=mail.kubisiak.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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 | 13 +++++++++++++ guix/self.scm | 1 + guix/ui.scm | 13 ++++++++++--- 4 files changed, 28 insertions(+), 6 deletions(-) base-commit: 369d2698b0bfc3726f8e6d232d43d0dda832225f prerequisite-patch-id: cd0707c90e1d321f3f16f2f861313dd330e9f0b4 diff --git a/gnu/packages.scm b/gnu/packages.scm index 80c22d1d7f..05b8bf8e6d 100644 --- a/gnu/packages.scm +++ b/gnu/packages.scm @@ -147,15 +147,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..3bbda15db5 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,17 @@ (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 () + (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..28690b22bc 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,15 @@ (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? + (append + (parse-path + (getenv "GUIX_EXTENSIONS_PATH")) + (map + (cut string-append <> "/guix/extensions") + channels))))) (define (commands) "Return the list of commands, alphabetically sorted."