guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: avoid Computing Guix derivation when not necessary


From: Ludovic Courtès
Subject: Re: avoid Computing Guix derivation when not necessary
Date: Sun, 12 Feb 2023 01:10:42 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Hi Nicolas!

Nicolas Graves via "Development of GNU Guix and the GNU System
distribution." <guix-devel@gnu.org> skribis:

> I found an working solution to avoid waiting for the `Computing Guix
> derivation' part when pulling or else.
>
> Here's my snippet:
>
> ```
> (use-modules
>  (git)
>  (guix profiles)
>  (srfi srfi-1))
>
> (reduce (lambda (x y) (and x y)) #f
>         (map
>          (lambda (x)
>            (let* ((elts (cdadar (manifest-entry-properties x)))
>                   (repository (repository-open (car (assoc-ref elts 'url))))
>                   (commit (oid->string
>                            (object-id
>                             (revparse-single repository
>                                              (car (assoc-ref elts 
> 'branch)))))))
>              (string= commit (car (assoc-ref elts 'commit)))))
>          (manifest-entries (profile-manifest "./.guix-profile/guix"))))
> ```
>
> For the moment, I'm using a profile and local development directories to
> avoid this recomputation when I need to run guix system and guix home,
> but I think this could be included to speed up guix pull when no new
> commits are found.

Wait, ‘guix system’ and ‘guix home’ do not do the infamous “Computing
Guix derivation” step; that’s only for ‘guix pull’, ‘guix time-machine’,
and inferiors.

What are you doing exactly?  :-)

> The principle is simple: get commit and directory info from the profile
> manifest, compare commits, if commits for all channels are the same, do
> not try to update the profile.
>
> It may not be as interessing for guix pull (need to pull anyway to get
> the last commit...). If you think this can have some use, I can rework
> on it for guix ;)

I don’t fully understand the use case yet, but who knows!

One marginal improvement would be sharing the cache that ‘time-machine’
uses with ‘guix pull’.  Last I looked it wasn’t as easy as one might
hope, but I forgot the details.

Thanks,
Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]