guix-devel
[Top][All Lists]
Advanced

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

avoid Computing Guix derivation when not necessary


From: Nicolas Graves
Subject: avoid Computing Guix derivation when not necessary
Date: Fri, 10 Feb 2023 14:25:31 +0100

Hi guix!

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.

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

-- 
Best regards,
Nicolas Graves



reply via email to

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