From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id WNW7L5vqnV9+OwAA0tVLHw (envelope-from ) for ; Sat, 31 Oct 2020 22:52:11 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id QMmsK5vqnV/bNwAA1q6Kng (envelope-from ) for ; Sat, 31 Oct 2020 22:52:11 +0000 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 7D4C89403CC for ; Sat, 31 Oct 2020 22:52:11 +0000 (UTC) Received: from localhost ([::1]:59934 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYzjG-0004ox-G3 for larch@yhetil.org; Sat, 31 Oct 2020 18:52:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYziw-0004nn-89 for guix-devel@gnu.org; Sat, 31 Oct 2020 18:51:50 -0400 Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21130) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYzit-00085n-WE; Sat, 31 Oct 2020 18:51:49 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1604184706; cv=none; d=zohomail.com; s=zohoarc; b=lJtsicbOwDTGyMHKAOYwCknxyHjS6etncM+Mi9R5IJ0LHEAo/puxYI4pVDoa0ZkA8/7davc7SzTNhSAsKU1Jg0nFrYoI6WhwtUvNy444gMmlWjYCKgYRdVATQkdM7j8eO6CMjU4DDCvNIl4oNuTCwyuaiPMNpWFNPrjmRGrPjdU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604184706; h=Content-Type:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=gy8sesaZvLEuxJwh/a41qpV+Rggwt7WlVIIKXOG3uro=; b=IcEtYipzG+cF+nQYUxOX5vYiIzTHaeaYhOGj3fygfdF9PsHmaX/FLuRgKRji2En06mXF2QPMQwFdC3uTFAP+YIQJpr9c3IcHoju8q9GX5Zsf/NgMD+X2IkWSBqXtOVuoBw3so4Z25kcO46xJdiLwNUzeXlbLIvoZdvPp0HZhA1U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1604184706; s=zoho; d=elephly.net; i=rekado@elephly.net; h=References:From:To:Cc:Subject:In-reply-to:Message-ID:Date:MIME-Version:Content-Type; bh=gy8sesaZvLEuxJwh/a41qpV+Rggwt7WlVIIKXOG3uro=; b=hBF6rhv7RQ01ZOcgX1tW8GhUdICjj65Xh8nck9m6QEgp0UUaKbl3X5h1wC4V06Cc oMUlo2RdiH04dUohSBth8+lgcatA3zHvBEjBtr0v193CfUTpOFFNIXWp54GpTe7CrRQ WADspR6sZPNLDfclARL8SfgQmyC4X2AVukhqFyOI= Received: from localhost (p54ad4bef.dip0.t-ipconnect.de [84.173.75.239]) by mx.zohomail.com with SMTPS id 1604184704592138.80316646082395; Sat, 31 Oct 2020 15:51:44 -0700 (PDT) References: <87o8tulhci.fsf@elephly.net> <871rpxu2fb.fsf@gnu.org> User-agent: mu4e 1.4.13; emacs 27.1 From: Ricardo Wurmus To: Ludovic =?utf-8?Q?Court=C3=A8s?= , =?utf-8?Q?G=C3=A1bor?= Boskovits , Julien Lepiller Subject: Re: Extending Guix without using the Guile load path In-reply-to: <871rpxu2fb.fsf@gnu.org> X-URL: https://elephly.net X-PGP-Key: https://elephly.net/rekado.pubkey X-PGP-Fingerprint: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC Message-ID: <87tuuayplb.fsf@elephly.net> Date: Sat, 31 Oct 2020 23:53:36 +0100 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-ZohoMailClient: External X-Zoho-Virus-Status: 1 Received-SPF: pass client-ip=136.143.188.51; envelope-from=rekado@elephly.net; helo=sender4-of-o51.zoho.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/31 18:51:24 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Guix-devel Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=elephly.net header.s=zoho header.b=hBF6rhv7; arc=pass (zohomail.com:s=zohoarc:i=1); dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Spam-Score: -2.21 X-TUID: huvwD/ZAQFGG --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: > Hello! > > Ricardo Wurmus skribis: > >> I think it=E2=80=99s a bit difficult to install the Guix Workflow Langua= ge at >> this point and I=E2=80=99d like to change that. >> >> Currently, new sub-commands for Guix are looked up by module name on the >> Guile load path. When installing the =E2=80=9Cgwl=E2=80=9D package, tho= ugh, the Guile >> load path is not automatically altered, so users need to set it up by >> themselves. The load path is only altered automatically when users >> install the =E2=80=9Cguile=E2=80=9D package. This is not a good recomme= ndation because >> users may have Guile 2.2 in their profile, and not Guile 3.0 or whatever >> version may be needed by the extension. >> >> I wonder if we can make this a little nicer by letting Guix look for >> sub-command scripts in directories that are listed in an environment >> variable, such as GUIX_EXTENSIONS_PATH. The =E2=80=9Cguix=E2=80=9D pack= age would set >> this search path and packages wanting to provide a sub-command (such as >> =E2=80=9Cguix workflow=E2=80=9D or =E2=80=9Cguix home=E2=80=9D) would ar= range to have their scripts >> placed in that sub-directory of their outputs. >> >> What do you think? > > GUIX_EXTENSIONS_PATH sounds like a good idea. I suppose it could be > implemented pretty much like GUIX_PACKAGE_PATH? > > That would also allow us to consider Guix Home a package rather than a > channel, like you did for GWL. Below is a draft that adds Guile modules from GUIX_EXTENSIONS_PATH to the %load-path and %load-compiled-path. I think this implementation is not good, but I=E2=80=99d like to provoke so= me comments about the following thoughts: * what happens to the Guile dependencies of an extension? Those would not be added to the load path. Should the extension take care of this by manually augmenting the load path? * The draft simply uses the same directories that GUILE_LOAD_PATH and GUILE_LOAD_COMPILED_PATH use. Is this a bad idea? Would it not be better to have a new directory prefix (such as =E2=80=9Clib/guix/extensio= ns=E2=80=9D)? * The search path on the =E2=80=9Cguix=E2=80=9D package does not distinguis= h between compiled modules and source modules; it simply looks for all the conventional directories and puts them on the GUIX_EXTENSIONS_PATH, while (guix ui) adds them to both %load-path and %load-compiled-path. All these points could be solved by only requiring the *entry points* to be on the GUIX_EXTENSIONS_PATH. Say for example that we have the =E2=80=9Cworkflows=E2=80=9D extension (provided by the GWL), which is a Gui= le entry point script at =E2=80=9Clibexec/guix/workflows.scm=E2=80=9D. That script = would augment the %load-path and %load-compiled-path with all its modules (in the conventional Guile directories) and load the extension from those modules. What do you think? --=20 Ricardo --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-WIP-GUIX_EXTENSIONS_PATH.patch Content-Transfer-Encoding: quoted-printable >From a6bdaee8a8cf403ea0cc76426e595afc36c9f559 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Sat, 31 Oct 2020 23:42:12 +0100 Subject: [PATCH] WIP: GUIX_EXTENSIONS_PATH --- gnu/packages/package-management.scm | 14 +++++++++++++- guix/ui.scm | 11 ++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-man= agement.scm index 1c02c342b1..b6c03acf15 100644 --- a/gnu/packages/package-management.scm +++ b/gnu/packages/package-management.scm @@ -400,6 +400,12 @@ $(prefix)/etc/init.d\n"))) ("guile-git" ,guile-git) ("guile-zlib" ,guile-zlib) ("guile-lzlib" ,guile-lzlib))) + (native-search-paths + (list (search-path-specification + (variable "GUIX_EXTENSIONS_PATH") + (files '("share/guile/site/3.0" + "lib/guile/3.0/site-ccache" + "share/guile/site/3.0"))))) =20 (home-page "https://www.gnu.org/software/guix/") (synopsis "Functional package manager for installed software package= s and versions") @@ -496,7 +502,13 @@ the Nix package manager.") ("guile-json" ,guile2.2-json) ("guile-sqlite3" ,guile2.2-sqlite3) ("guile-ssh" ,guile2.2-ssh) - ("guile-git" ,guile2.2-git))))) + ("guile-git" ,guile2.2-git))) + (native-search-paths + (list (search-path-specification + (variable "GUIX_EXTENSIONS_PATH") + (files '("share/guile/site/2.2" + "lib/guile/2.2/site-ccache" + "share/guile/site/2.2"))))))) =20 (define-public guile3.0-guix (deprecated-package "guile3.0-guix" guix)) diff --git a/guix/ui.scm b/guix/ui.scm index 8d7bc238bc..8dbcbe0fd6 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -10,7 +10,7 @@ ;;; Copyright =C2=A9 2016 Roel Janssen ;;; Copyright =C2=A9 2016 Benz Schenk ;;; Copyright =C2=A9 2018 Kyle Meyer -;;; Copyright =C2=A9 2018 Ricardo Wurmus +;;; Copyright =C2=A9 2018, 2020 Ricardo Wurmus ;;; Copyright =C2=A9 2019 Chris Marusich ;;; Copyright =C2=A9 2019 Tobias Geerinckx-Rice ;;; Copyright =C2=A9 2019 Simon Tournier @@ -61,6 +61,7 @@ ;; Avoid "overrides core binding" warning. delete)) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-2) #:use-module (srfi srfi-9 gnu) #:use-module (srfi srfi-11) #:use-module (srfi srfi-19) @@ -2125,6 +2126,14 @@ Unlike 'guix-main', this procedure assumes that loca= le, i18n support, and signal handling have already been set up." (define option? (cut string-prefix? "-" <>)) =20 + (and-let* ((path (getenv "GUIX_EXTENSIONS_PATH")) + (not-colon (char-set-complement (char-set #\:))) + (extensions (string-tokenize path not-colon))) + (set! %load-path + (append extensions %load-path)) + (set! %load-compiled-path + (append extensions %load-compiled-path))) + ;; The default %LOAD-EXTENSIONS includes the empty string, which doubles= the ;; number of 'stat' calls per entry in %LOAD-PATH. Shamelessly remove i= t. (set! %load-extensions '(".scm")) --=20 2.28.0 --=-=-=--