unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* guix pull only from private channel
@ 2020-12-15 17:58 Phil
  2020-12-16 14:07 ` zimoun
  0 siblings, 1 reply; 6+ messages in thread
From: Phil @ 2020-12-15 17:58 UTC (permalink / raw)
  To: help-guix

Hi all,

Two things I can't find clarified anywhere - when doing a guix pull from a
private channel which provides supplementary packages to the standard
Guix channel.

1) If the private channel is a git repo accessed via ssh it seems
necessary to add the ssh key to an ssh-agent rather than have it pick up
~/.ssh/id_rsa.  This isn't a huge problem but when the ssh key has no
passphrase the use of an agent is actually more complicated than passing
the key directly?  Is it possible to specify a key file, and if not, is
there any good reason why not (I thought perhaps it might be access via
the guix-daemon or similar at a wild guess)?

2) Assuming I use an ssh-agent to avoid issue in 1), if I want to only
pull updates from my private channel and not from the Guix channel, I
find myself doing something like the below to force Guix channel to stay constant:

eval `ssh-agent` && ssh-add && guix pull --commit=$(guix describe -f
json | jq -r '.[] | select(.name=="guix").commit') && guix upgrade my-package-name

This works, but it feels rather ugly - is there an easier way of saying
"hold guix constant, but pull in latest updates from my private
channel" - it feels like a common use-case to me?


Thanks,
Phil.



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

* Re: guix pull only from private channel
  2020-12-15 17:58 guix pull only from private channel Phil
@ 2020-12-16 14:07 ` zimoun
  2020-12-19 12:28   ` Phil
  0 siblings, 1 reply; 6+ messages in thread
From: zimoun @ 2020-12-16 14:07 UTC (permalink / raw)
  To: Phil; +Cc: help-guix

Hi,

On Tue, 15 Dec 2020 at 19:29, Phil <phil@beadling.co.uk> wrote:

> 1) If the private channel is a git repo accessed via ssh it seems
> necessary to add the ssh key to an ssh-agent rather than have it pick up
> ~/.ssh/id_rsa.  This isn't a huge problem but when the ssh key has no
> passphrase the use of an agent is actually more complicated than passing
> the key directly?  Is it possible to specify a key file, and if not, is
> there any good reason why not (I thought perhaps it might be access via
> the guix-daemon or similar at a wild guess)?

About this, I do not know.

> 2) Assuming I use an ssh-agent to avoid issue in 1), if I want to only
> pull updates from my private channel and not from the Guix channel, I
> find myself doing something like the below to force Guix channel to stay constant:
>
> eval `ssh-agent` && ssh-add && guix pull --commit=$(guix describe -f
> json | jq -r '.[] | select(.name=="guix").commit') && guix upgrade my-package-name
>
> This works, but it feels rather ugly - is there an easier way of saying
> "hold guix constant, but pull in latest updates from my private
> channel" - it feels like a common use-case to me?

About this, you should write a specific channels.scm file and then run:

  guix pull -C channels.scm

where the file is for example:

--8<---------------cut here---------------start------------->8---
(use-modules
 (guix utils)
 (guix profiles)
 (guix channels)
 (guix openpgp))

(define guix (car %default-channels))
(define current (string-append (config-directory #:ensure? #f) "/current"))
(define channels (profile-channels current))
(define defaults (filter (lambda (channel)
                          (define (channel=? channel1 channel2)
                            (equal?
                             (channel-name channel1)
                             (channel-name channel2)))
                          (channel=? channel guix))
                        channels))

(append
 defaults
 (list
  (channel
  (name 'past)
  (url "https://gitlab.inria.fr/guix-hpc/guix-past.git")
  (branch "master"))))
--8<---------------cut here---------------end--------------->8---

Obviously, this is a quick example and you could filter as you
want--here only with the channel name "guix".  And this file could be
in '~/.config/guix/channels.scm' and so "guix pull" would only pull
everything except the channel named 'guix' which stays constant.  Then
to update the current 'guix' channel, you could have another file, for
instance ~/.config/guix/default-channels.scm containing only one line
with "%default-channels" and so "guix pull -C
~/.config/guix/default-channels.scm" would only update the default
ones.

The point is: instead of this ugly command line with ugly filtering,
you should investigate in the Scheme API. :-)

Hope that helps,
simon


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

* Re: guix pull only from private channel
  2020-12-16 14:07 ` zimoun
@ 2020-12-19 12:28   ` Phil
  2020-12-21 12:16     ` zimoun
  0 siblings, 1 reply; 6+ messages in thread
From: Phil @ 2020-12-19 12:28 UTC (permalink / raw)
  To: zimoun; +Cc: help-guix

Thanks Simon - that helped!

zimoun writes:

> About this, you should write a specific channels.scm file and then run:
>
>   guix pull -C channels.scm
>

The bit I was missing was how do I create a channels file that keeps
'guix' at a constant commit - the scheme snippet you sent me is perfect, and
gave me a good way-in to the API - thanks!

One question - what's the reasoning about making all channel files have
a guix channel?  Obviously it makes sense that there must be a guix
channel referenced somewhere - but my expectation was (wrongly) that if
I created a channel file with only my private channel in it, it would
simply ignore guix and pull only what my private channel offered.  Instead it
complains that there is no guix channel defined.

I'm guessing it wants to weigh-up guix vs my private channel to pick the
latest version of a package from either, but that doesn't make sense to
me if I know that my private channel contains packages which are always
mutually exclusive from the guix channel?


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

* Re: guix pull only from private channel
  2020-12-19 12:28   ` Phil
@ 2020-12-21 12:16     ` zimoun
  2020-12-22  9:27       ` Phil
  0 siblings, 1 reply; 6+ messages in thread
From: zimoun @ 2020-12-21 12:16 UTC (permalink / raw)
  To: Phil; +Cc: help-guix

Hi,

On Sat, 19 Dec 2020 at 12:28, Phil <phil@beadling.co.uk> wrote:

> The bit I was missing was how do I create a channels file that keeps
> 'guix' at a constant commit - the scheme snippet you sent me is perfect, and
> gave me a good way-in to the API - thanks!

Do not take the snippet as bullet-proof.  It is a quick example to
illustrate the Guix power. ;-)


> One question - what's the reasoning about making all channel files have
> a guix channel?  Obviously it makes sense that there must be a guix
> channel referenced somewhere - but my expectation was (wrongly) that if
> I created a channel file with only my private channel in it, it would
> simply ignore guix and pull only what my private channel offered.  Instead it
> complains that there is no guix channel defined.

You mean that:

--8<---------------cut here---------------start------------->8---
$ cat /tmp/one-channel.scm
(list
 (channel
  (name 'past)
  (url "https://gitlab.inria.fr/guix-hpc/guix-past.git")))

$ guix pull -C /tmp/one-channel.scm -p /tmp/one
Updating channel 'past' from Git repository at 'https://gitlab.inria.fr/guix-hpc/guix-past.git'...
guix pull: warning: pulled channel 'past' from a mirror of https://gitlab.inria.fr/guix-hpc/guix-past, which might be stale
Building from this channel:
  past      https://gitlab.inria.fr/guix-hpc/guix-past.git	829923f
/tmp/one-channel.scm:2:1: error: 'guix' channel is lacking
hint: Make sure your list of channels contains one channel named `guix' providing the core of Guix.
--8<---------------cut here---------------end--------------->8---

Well, somehow you need one channel that provides the command “guix”.  It
is possible to cheat with a local clone and set url to “file:///path/to/clone”.

> I'm guessing it wants to weigh-up guix vs my private channel to pick the
> latest version of a package from either, but that doesn't make sense to
> me if I know that my private channel contains packages which are always
> mutually exclusive from the guix channel?

I am not sure to understand what you want to do, but you can pin one
“guix” version with something like:

--8<---------------cut here---------------start------------->8---
(list
 (channel
  (name 'past)
  (url "https://gitlab.inria.fr/guix-hpc/guix-past.git"))
 (channel
  (name 'guix) ; avoid to recompute heavy derivations and build modules
  (url "https://git.savannah.gnu.org/git/guix.git")
  (commit "d62c9b2671be55ae0305bebfda17b595f33797f2"))) ; v1.1.0
--8<---------------cut here---------------end--------------->8---


Hope that helps,
simon


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

* Re: guix pull only from private channel
  2020-12-21 12:16     ` zimoun
@ 2020-12-22  9:27       ` Phil
  2020-12-22 11:44         ` zimoun
  0 siblings, 1 reply; 6+ messages in thread
From: Phil @ 2020-12-22  9:27 UTC (permalink / raw)
  To: zimoun; +Cc: help-guix


zimoun writes:

> Hi,
>
> Do not take the snippet as bullet-proof.  It is a quick example to
> illustrate the Guix power. ;-)

Yep understood - it was a good starting point for me to expand on!

> You mean that:
>

> $ guix pull -C /tmp/one-channel.scm -p /tmp/one

> /tmp/one-channel.scm:2:1: error: 'guix' channel is lacking
> hint: Make sure your list of channels contains one channel named `guix' providing the core of Guix.

Yes - I think I understand now, having re-read parts of the manual.  A
channel.scm represents a guix channel AND optional other channels.  It
has to describe where guix is.

> I am not sure to understand what you want to do, but you can pin one
> “guix” version with something like:
>
> --8<---------------cut here---------------start------------->8---
> (list
>  (channel
>   (name 'past)
>   (url "https://gitlab.inria.fr/guix-hpc/guix-past.git"))
>  (channel
>   (name 'guix) ; avoid to recompute heavy derivations and build modules
>   (url "https://git.savannah.gnu.org/git/guix.git")
>   (commit "d62c9b2671be55ae0305bebfda17b595f33797f2"))) ; v1.1.0
> --8<---------------cut here---------------end--------------->8---
>

Yep this is what I've ended up doing - but am still a bit surprised that
even with a pinned guix commit id, and a private channel containing a
single trivial package with available substitute, doing a 'git pull' is
still fairly expensive (approx 1min).  This is quicker than pulling
latest guix, of course - so there is some improvement.

I was hoping that pinning the guix channel would make 'guix pull'
pretty fast.

My guess is that even though no packages are downloaded to update the
guix channel, time is still required to create the updated profile with the
pinned guix and the update to the single package in my private channel?

-------

In my (simple/limited) use-case I can avoid the 'guix pull' altogether by using
use of GUIX_PACKAGE_PATH to point to my local packages that I'm
updating - no 'guix pull' is then needed (unlike a local channel/git
repo) and I get rid of the 1min wait.

This works well but having read this in the cookbook:

"Note: Starting from Guix 0.16, the more flexible Guix channels are the
preferred way and supersede ‘GUIX_PACKAGE_PATH’."

I'm wondering GUIX_PACKAGE_PATH is ultimately going to be removed, and
replaced by local clones of channels (which I accept are far more
flexible, but in my specific use-case less efficient)?

I don't suppose anyone cares to comment on if GUIX_PACKAGE_PATH is
likely to be completely phased out in favor of channels or if it is
recognized as separately useful to channels?

Personally I think GUIX_PACKAGE_PATH still serves some practical
purpose, which is not as well covered by channels?




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

* Re: guix pull only from private channel
  2020-12-22  9:27       ` Phil
@ 2020-12-22 11:44         ` zimoun
  0 siblings, 0 replies; 6+ messages in thread
From: zimoun @ 2020-12-22 11:44 UTC (permalink / raw)
  To: Phil; +Cc: help-guix

Hi,

On Tue, 22 Dec 2020 at 09:27, Phil <phil@beadling.co.uk> wrote:

> Yep this is what I've ended up doing - but am still a bit surprised that
> even with a pinned guix commit id, and a private channel containing a
> single trivial package with available substitute, doing a 'git pull' is
> still fairly expensive (approx 1min).  This is quicker than pulling
> latest guix, of course - so there is some improvement.

I agree.  Some optimizations could be done, maybe by cutting some
unnecessary computations or check.

> Personally I think GUIX_PACKAGE_PATH still serves some practical
> purpose, which is not as well covered by channels?

Personally, I do not use GUIX_PACKAGE_PATH for local packages but the
option ’--load-path’ when I need it.


All the best,
simon


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

end of thread, other threads:[~2020-12-22 11:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-15 17:58 guix pull only from private channel Phil
2020-12-16 14:07 ` zimoun
2020-12-19 12:28   ` Phil
2020-12-21 12:16     ` zimoun
2020-12-22  9:27       ` Phil
2020-12-22 11:44         ` zimoun

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).