all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Olivier Dion via <help-guix@gnu.org>
To: help-guix@gnu.org
Subject: Re: guix-pack on package record
Date: Wed, 17 Aug 2022 16:59:17 -0400	[thread overview]
Message-ID: <87r11ek2my.fsf@laura> (raw)
In-Reply-To: <87tu6ak3lb.fsf@laura>

On Wed, 17 Aug 2022, Olivier Dion via <help-guix@gnu.org> wrote:
> I would like to use `guix pack` but at the scheme level.  I have package
> records that I generate dynamically and would like to pack them
> individually in the same way.  Is there an easy way for that?

Here's a solution that I've scratch quickly:
--8<---------------cut here---------------start------------->8---

(use-modules
  (guix derivations)
  (guix monads)
  (guix profiles)
  (guix scripts pack)
  (guix store))

(define* (bundle-package package . rest)

  (define manifest (packages->manifest (list package)))
  (define profile (profile (content manifest)))

  (run-with-store (open-connection)
    (mlet %store-monad ((drv (apply self-contained-tarbar
                                    (package-name package)
                                    profile
                                    rest)))
      (mbegin %store-monad
        (built-derivations (list drv))
        (return (derivation->output-path drv))))))
--8<---------------cut here---------------end--------------->8---

It seems to work okay.  Though?

-- 
Olivier Dion
oldiob.dev


  reply	other threads:[~2022-08-17 20:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-17 20:38 guix-pack on package record Olivier Dion via
2022-08-17 20:59 ` Olivier Dion via [this message]
2022-08-22 15:08   ` zimoun
2022-08-25  4:24     ` Olivier Dion via

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=87r11ek2my.fsf@laura \
    --to=help-guix@gnu.org \
    --cc=olivier.dion@polymtl.ca \
    /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.