unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Document GUIX_LOAD_PATH?
@ 2019-12-18 11:28 Pierre Neidhardt
  2019-12-18 13:17 ` zimoun
  0 siblings, 1 reply; 15+ messages in thread
From: Pierre Neidhardt @ 2019-12-18 11:28 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 214 bytes --]

Hi!

Today I learned about the existence of GUIX_LOAD_PATH.  It does not seem
to be documented in the manual.  Is it anywhere in the doc?  Shall we
document it?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Document GUIX_LOAD_PATH?
  2019-12-18 11:28 Document GUIX_LOAD_PATH? Pierre Neidhardt
@ 2019-12-18 13:17 ` zimoun
  2019-12-19 10:45   ` Clément Lassieur
  0 siblings, 1 reply; 15+ messages in thread
From: zimoun @ 2019-12-18 13:17 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: Guix Devel

Hi Pierre,

On Wed, 18 Dec 2019 at 12:28, Pierre Neidhardt <mail@ambrevar.xyz> wrote:

> Today I learned about the existence of GUIX_LOAD_PATH.  It does not seem
> to be documented in the manual.  Is it anywhere in the doc?  Shall we
> document it?

It can be documented in devel pages., maybe Contributing.

But IMHO, the normal use should be via the --load-path option and the
GUIX_LOAD_PATH should be less and less used; stay here for historical
reason and/or backward compatibility and/or some devel use-case.

Well, for discoverability, it appears to me easier to list an option
with "guix <cmd> --help" than list environment variables.


All the best,
simon

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Document GUIX_LOAD_PATH?
  2019-12-18 13:17 ` zimoun
@ 2019-12-19 10:45   ` Clément Lassieur
  2019-12-19 10:59     ` Pierre Neidhardt
  0 siblings, 1 reply; 15+ messages in thread
From: Clément Lassieur @ 2019-12-19 10:45 UTC (permalink / raw)
  To: zimoun; +Cc: Guix Devel

zimoun <zimon.toutoune@gmail.com> writes:

> Hi Pierre,
>
> On Wed, 18 Dec 2019 at 12:28, Pierre Neidhardt <mail@ambrevar.xyz> wrote:
>
>> Today I learned about the existence of GUIX_LOAD_PATH.  It does not seem
>> to be documented in the manual.  Is it anywhere in the doc?  Shall we
>> document it?
>
> It can be documented in devel pages., maybe Contributing.
>
> But IMHO, the normal use should be via the --load-path option and the
> GUIX_LOAD_PATH should be less and less used; stay here for historical
> reason and/or backward compatibility and/or some devel use-case.
>
> Well, for discoverability, it appears to me easier to list an option
> with "guix <cmd> --help" than list environment variables.

Hi Simon and Pierre,

It was me who talked to you about it, and...  It's not GUIX_LOAD_PATH,
it's GUIX_PACKAGE_PATH, sorry!!

(And it's documented :))

See you soon!
Clément

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Document GUIX_LOAD_PATH?
  2019-12-19 10:45   ` Clément Lassieur
@ 2019-12-19 10:59     ` Pierre Neidhardt
  2019-12-19 16:57       ` Ludovic Courtès
  0 siblings, 1 reply; 15+ messages in thread
From: Pierre Neidhardt @ 2019-12-19 10:59 UTC (permalink / raw)
  To: Clément Lassieur, zimoun; +Cc: Guix Devel

[-- Attachment #1: Type: text/plain, Size: 83 bytes --]

Hahaha, sorry for the noise then!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Document GUIX_LOAD_PATH?
  2019-12-19 10:59     ` Pierre Neidhardt
@ 2019-12-19 16:57       ` Ludovic Courtès
  2019-12-19 17:04         ` Pierre Neidhardt
  0 siblings, 1 reply; 15+ messages in thread
From: Ludovic Courtès @ 2019-12-19 16:57 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: Guix Devel, Clément Lassieur

Also, GUIX_PACKAGE_PATH is not “recommended”—channels FTW!

Ludo’.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Document GUIX_LOAD_PATH?
  2019-12-19 16:57       ` Ludovic Courtès
@ 2019-12-19 17:04         ` Pierre Neidhardt
  2019-12-19 17:09           ` zimoun
  2019-12-19 21:13           ` Document GUIX_LOAD_PATH? zimoun
  0 siblings, 2 replies; 15+ messages in thread
From: Pierre Neidhardt @ 2019-12-19 17:04 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix Devel, Clément Lassieur

[-- Attachment #1: Type: text/plain, Size: 512 bytes --]

The reason this came up was because the --load-path command line
argument was missing from some command.  Then Clément argued that it was
not necessary anyways, we could set GUIX_PACKAGE_PATH (I didn't know
that it was effectively the same as --load-path, but for all commands).

So the question is: shall we add --load-path to all commands instead?
(If not already the case.)

Side question: Can we really do everything without using GUIX_PACKAGE_PATH?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Document GUIX_LOAD_PATH?
  2019-12-19 17:04         ` Pierre Neidhardt
@ 2019-12-19 17:09           ` zimoun
  2019-12-19 17:14             ` Pierre Neidhardt
  2019-12-19 21:13           ` Document GUIX_LOAD_PATH? zimoun
  1 sibling, 1 reply; 15+ messages in thread
From: zimoun @ 2019-12-19 17:09 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: Guix Devel, Clément Lassieur

On Thu, 19 Dec 2019 at 18:04, Pierre Neidhardt <mail@ambrevar.xyz> wrote:

> So the question is: shall we add --load-path to all commands instead?
> (If not already the case.)

Only commands that need it. :-)

Do you have in mind commands where the option --load-path is still missing?
Maybe "guix graph"?
Maybe "guix edit"?

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Document GUIX_LOAD_PATH?
  2019-12-19 17:09           ` zimoun
@ 2019-12-19 17:14             ` Pierre Neidhardt
  2019-12-26 20:31               ` Command line option in addition to GUIX_PACKAGE_PATH - Reason? Danny Milosavljevic
  0 siblings, 1 reply; 15+ messages in thread
From: Pierre Neidhardt @ 2019-12-19 17:14 UTC (permalink / raw)
  To: zimoun; +Cc: Guix Devel, Clément Lassieur

[-- Attachment #1: Type: text/plain, Size: 434 bytes --]

zimoun <zimon.toutoune@gmail.com> writes:

> Do you have in mind commands where the option --load-path is still missing?
> Maybe "guix graph"?

Yes.

> Maybe "guix edit"?

Yes.

Also:

- guix size (this one has annoyed me for a long time!)

- Maybe guix import?  What if a channel / local repo specifies a new
  importer?

- guix refresh

I think that would be it.

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Document GUIX_LOAD_PATH?
  2019-12-19 17:04         ` Pierre Neidhardt
  2019-12-19 17:09           ` zimoun
@ 2019-12-19 21:13           ` zimoun
  1 sibling, 0 replies; 15+ messages in thread
From: zimoun @ 2019-12-19 21:13 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: Guix Devel, Clément Lassieur

Hi,

On Thu, 19 Dec 2019 at 18:04, Pierre Neidhardt <mail@ambrevar.xyz> wrote:

> So the question is: shall we add --load-path to all commands instead?
> (If not already the case.)

Please comment patches #38678.

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=38678


All the best,
simon

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Command line option in addition to GUIX_PACKAGE_PATH - Reason?
  2019-12-19 17:14             ` Pierre Neidhardt
@ 2019-12-26 20:31               ` Danny Milosavljevic
  2019-12-28  9:56                 ` Pierre Neidhardt
  2019-12-30 18:29                 ` zimoun
  0 siblings, 2 replies; 15+ messages in thread
From: Danny Milosavljevic @ 2019-12-26 20:31 UTC (permalink / raw)
  To: Pierre Neidhardt, zimoun; +Cc: Guix Devel, Clément Lassieur

[-- Attachment #1: Type: text/plain, Size: 932 bytes --]

Hi Pierre,
Hi zimoun,

On Thu, 19 Dec 2019 18:14:53 +0100
Pierre Neidhardt <mail@ambrevar.xyz> wrote:

> zimoun <zimon.toutoune@gmail.com> writes:
> 
> > Do you have in mind commands where the option --load-path is still missing?
> > Maybe "guix graph"?  
> 
> Yes.
> 
> > Maybe "guix edit"?  
> 
> Yes.

... why?  There's the environment variable already--what does it give us
to have yet another way to specify the value?

Shells allow you to do

  ENVVAR1=value command1

anyway.

zimoun wrote:

>But IMHO, the normal use should be via the --load-path option and the
>GUIX_LOAD_PATH should be less and less used; stay here for historical
>reason and/or backward compatibility and/or some devel use-case.

Why?  *PATH environment variables have a long tradition in UNIX and are not
going to vanish (or mean something else any time) soon.  What is the use
case this change is supposed to enable?

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Command line option in addition to GUIX_PACKAGE_PATH - Reason?
  2019-12-26 20:31               ` Command line option in addition to GUIX_PACKAGE_PATH - Reason? Danny Milosavljevic
@ 2019-12-28  9:56                 ` Pierre Neidhardt
  2019-12-30 18:29                 ` zimoun
  1 sibling, 0 replies; 15+ messages in thread
From: Pierre Neidhardt @ 2019-12-28  9:56 UTC (permalink / raw)
  To: Danny Milosavljevic, zimoun; +Cc: Guix Devel, Clément Lassieur

[-- Attachment #1: Type: text/plain, Size: 393 bytes --]

Hi Danny!

The environment variable is deprecated if I understand properly.
Either way, we need to be consistent.  Some subcommands support
--load-path while others don't, for no apparent reason.  I believe it's
a good idea to minimize the element of surprise and conversely maximize
familiarity with the command line options.

Cheers!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Command line option in addition to GUIX_PACKAGE_PATH - Reason?
  2019-12-26 20:31               ` Command line option in addition to GUIX_PACKAGE_PATH - Reason? Danny Milosavljevic
  2019-12-28  9:56                 ` Pierre Neidhardt
@ 2019-12-30 18:29                 ` zimoun
  2020-01-16 14:30                   ` Pierre Neidhardt
  1 sibling, 1 reply; 15+ messages in thread
From: zimoun @ 2019-12-30 18:29 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: Guix Devel, Clément Lassieur

Hi Danny,

Thank you for your insights.

On Thu, 26 Dec 2019 at 21:31, Danny Milosavljevic
<dannym@scratchpost.org> wrote:

> ... why?  There's the environment variable already--what does it give us
> to have yet another way to specify the value?

From my opinion, the answers to the why is:
 - because it is easier to explain to newcomers; only a new option and
not a new concept,
 - because it adds consistency with other commands, as Pierre said,
 - because it is easier to discover via "guix <cmd> -h"; even if it
should also be easy to add environment variables documentation via
"guix <cmd> -h".


> zimoun wrote:
>
> >But IMHO, the normal use should be via the --load-path option and the
> >GUIX_LOAD_PATH should be less and less used; stay here for historical
> >reason and/or backward compatibility and/or some devel use-case.
>
> Why?  *PATH environment variables have a long tradition in UNIX and are not
> going to vanish (or mean something else any time) soon.  What is the use
> case this change is supposed to enable?

Why? I do not know, maybe gray beard vs young mustache. ;-)
The option "--load-path" is more a flavor of taste than an use case
uncovered by GUIX_PACKAGE_PATH.
And GUIX_PACKAGE_PATH is not going to vanish.


Hope that helps.

All the best,
simon

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Command line option in addition to GUIX_PACKAGE_PATH - Reason?
  2019-12-30 18:29                 ` zimoun
@ 2020-01-16 14:30                   ` Pierre Neidhardt
  2020-01-16 16:12                     ` zimoun
  0 siblings, 1 reply; 15+ messages in thread
From: Pierre Neidhardt @ 2020-01-16 14:30 UTC (permalink / raw)
  To: zimoun, Danny Milosavljevic; +Cc: Guix Devel, Clément Lassieur

[-- Attachment #1: Type: text/plain, Size: 1070 bytes --]

I've merged your patch 38678.
Only one nit with guix refresh:

--8<---------------cut here---------------start------------->8---
+        ;; The short option -L is already used by --list-updaters, therefore
+        ;; it needs to be removed from %standard-build-options.
+        (let ((%load-path-option (find (lambda (option)
+                                         (member "load-path"
+                                                 (option-names option)))
+                                       %standard-build-options)))
+          (option
+           (filter (lambda (name) (not (equal? #\L name)))
+                   (option-names %load-path-option))
+           (option-required-arg? %load-path-option)
+           (option-optional-arg? %load-path-option)
+           (option-processor     %load-path-option)))
+
--8<---------------cut here---------------end--------------->8---

I would name the let-bound variable without a percent sign '%' by
convention.
Should I fix this for you?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Command line option in addition to GUIX_PACKAGE_PATH - Reason?
  2020-01-16 14:30                   ` Pierre Neidhardt
@ 2020-01-16 16:12                     ` zimoun
  2020-01-17 15:56                       ` Pierre Neidhardt
  0 siblings, 1 reply; 15+ messages in thread
From: zimoun @ 2020-01-16 16:12 UTC (permalink / raw)
  To: Pierre Neidhardt, 38678; +Cc: Guix Devel

[-- Attachment #1: Type: text/plain, Size: 203 bytes --]

On Thu, 16 Jan 2020 at 15:30, Pierre Neidhardt <mail@ambrevar.xyz> wrote:

> I've merged your patch 38678.

Cool! Thank you.


> Should I fix this for you?

Yes, for sure.
Patch attached.

Cheers,
simon

[-- Attachment #2: v5-0003-refresh-Add-load-path-option.patch --]
[-- Type: text/x-patch, Size: 3577 bytes --]

From 7ec82e221fdb42b6776ae4c41708d9ec361b4ebf Mon Sep 17 00:00:00 2001
From: zimoun <zimon.toutoune@gmail.com>
Date: Wed, 8 Jan 2020 18:53:01 +0100
Subject: [PATCH v5 3/6] refresh: Add '--load-path' option.

* guix/scripts/refresh.scm (%option): Add '--load-path' option.
* doc/guix.texi: Document it.
---
 doc/guix.texi            |  9 ++++++++-
 guix/scripts/refresh.scm | 18 ++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 3d26facd2e..bee4c3b2c9 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -69,7 +69,7 @@ Copyright @copyright{} 2019 Jakob L. Kreuze@*
 Copyright @copyright{} 2019 Kyle Andrews@*
 Copyright @copyright{} 2019 Alex Griffin@*
 Copyright @copyright{} 2019 Guillaume Le Vaillant@*
-Copyright @copyright{} 2019 Simon Tournier@*
+Copyright @copyright{} 2019, 2020 Simon Tournier@*
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -9552,6 +9552,13 @@ the user whether to download it or not.  This is the default behavior.
 @item --key-server=@var{host}
 Use @var{host} as the OpenPGP key server when importing a public key.
 
+@item --load-path=@var{directory}
+Add @var{directory} to the front of the package module search path
+(@pxref{Package Modules}).
+
+This allows users to define their own packages and make them visible to
+the command-line tools.
+
 @end table
 
 The @code{github} updater uses the
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index daf6fcf947..efada1df5a 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -7,6 +7,7 @@
 ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -27,6 +28,7 @@
   #:use-module (guix ui)
   #:use-module (gcrypt hash)
   #:use-module (guix scripts)
+  #:use-module ((guix scripts build) #:select (%standard-build-options))
   #:use-module (guix store)
   #:use-module (guix utils)
   #:use-module (guix packages)
@@ -116,6 +118,19 @@
                      (leave (G_ "unsupported policy: ~a~%")
                             arg)))))
 
+        ;; The short option -L is already used by --list-updaters, therefore
+        ;; it needs to be removed from %standard-build-options.
+        (let ((load-path-option (find (lambda (option)
+                                         (member "load-path"
+                                                 (option-names option)))
+                                       %standard-build-options)))
+          (option
+           (filter (lambda (name) (not (equal? #\L name)))
+                   (option-names load-path-option))
+           (option-required-arg? load-path-option)
+           (option-optional-arg? load-path-option)
+           (option-processor     load-path-option)))
+
         (option '(#\h "help") #f #f
                 (lambda args
                   (show-help)
@@ -165,6 +180,9 @@ specified with `--select'.\n"))
                          'always', 'never', and 'interactive', which is also
                          used when 'key-download' is not specified"))
   (newline)
+  (display (G_ "
+      --load-path=DIR    prepend DIR to the package module search path"))
+  (newline)
   (display (G_ "
   -h, --help             display this help and exit"))
   (display (G_ "
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: Command line option in addition to GUIX_PACKAGE_PATH - Reason?
  2020-01-16 16:12                     ` zimoun
@ 2020-01-17 15:56                       ` Pierre Neidhardt
  0 siblings, 0 replies; 15+ messages in thread
From: Pierre Neidhardt @ 2020-01-17 15:56 UTC (permalink / raw)
  To: zimoun, 38678; +Cc: Guix Devel

[-- Attachment #1: Type: text/plain, Size: 119 bytes --]

I have already merged, can you rebase your changes against master? :)

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2020-01-17 15:56 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-18 11:28 Document GUIX_LOAD_PATH? Pierre Neidhardt
2019-12-18 13:17 ` zimoun
2019-12-19 10:45   ` Clément Lassieur
2019-12-19 10:59     ` Pierre Neidhardt
2019-12-19 16:57       ` Ludovic Courtès
2019-12-19 17:04         ` Pierre Neidhardt
2019-12-19 17:09           ` zimoun
2019-12-19 17:14             ` Pierre Neidhardt
2019-12-26 20:31               ` Command line option in addition to GUIX_PACKAGE_PATH - Reason? Danny Milosavljevic
2019-12-28  9:56                 ` Pierre Neidhardt
2019-12-30 18:29                 ` zimoun
2020-01-16 14:30                   ` Pierre Neidhardt
2020-01-16 16:12                     ` zimoun
2020-01-17 15:56                       ` Pierre Neidhardt
2019-12-19 21:13           ` Document GUIX_LOAD_PATH? zimoun

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).