all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Simon Tournier <zimon.toutoune@gmail.com>
To: wifi <80211.532nf@simplelogin.co>, Guix Help <help-guix@gnu.org>
Subject: Re: How to export downloaded files for a system profile?
Date: Mon, 02 Dec 2024 19:59:03 +0100	[thread overview]
Message-ID: <87cyi9oqrs.fsf@gmail.com> (raw)
In-Reply-To: <173300778691.7.1670758004836259934.514586941@simplelogin.co>

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

Hi,

On Sat, 30 Nov 2024 at 23:03, wifi via <help-guix@gnu.org> wrote:

> I've been digging around looking for a way to build a complete build
> dependency and runtime dependency graph of every package and their
> derivations, but there doesn't appear to be a straightforward way to
> do it. If such a complete graph could be built, it seems to be only a
> matter of finding the leaf nodes and exporting those from the store.

Well, I think that you can write a manifest that walks the whole graph
and find the “leaf” packages, i.e., the packages that have no
dependents: packages that do appear elsewhere in any other packages.

Maybe there is some typo, but I think this manifest builds all the leaf
packages and thus it will build the whole packages of Guix.

Assuming, there is no mistake, I count 14143 leaf packages over 32459
packages.

Hope that helps.

Cheers,
simon


[-- Attachment #2: manifest.scm --]
[-- Type: text/plain, Size: 1193 bytes --]


(use-modules (gnu packages)
             (guix packages)
             (guix sets)
             (ice-9 match)
             (ice-9 vlist)
             (srfi srfi-1))

(define all (all-packages))

(define (p->k p)
  (string-append (package-name p) "@" (package-version p)))

(define vall-packages
  (fold (lambda (package result)
          (vhash-cons (p->k package) package result))
        vlist-null
        all))

(define vleaf-packages
  (vhash-fold (lambda (key package result)
                (let loop ((dependencies (package-direct-inputs package))
                           (updated result))
                  (match dependencies
                    ('() updated)
                    ((or ((_ p) . tail)
                         ((_ p _) . tail))
                     (if (package? p)
                         (loop tail
                               (vhash-delete (p->k p) updated))
                         (loop tail updated))))))
              vall-packages
              vall-packages))

(define leaf-packages
  (vhash-fold (lambda (key package result)
                (cons package result))
              '()
              vleaf-packages))

(packages->manifest
 leaf-packages)

      reply	other threads:[~2024-12-02 19:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-30 23:03 How to export downloaded files for a system profile? wifi via
2024-12-02 18:59 ` Simon Tournier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cyi9oqrs.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=80211.532nf@simplelogin.co \
    --cc=help-guix@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.