From: Maxime Devos <maximedevos@telenet.be>
To: 56114@debbugs.gnu.org
Subject: bug#56114: Guix does not have a documented general and practical procedure for lowering a single lowerable object to the /gnu/store/... string.
Date: Mon, 20 Jun 2022 23:01:54 +0200 [thread overview]
Message-ID: <1652a111d71c3e74c61904f89120ea45631c7013.camel@telenet.be> (raw)
[-- Attachment #1: Type: text/plain, Size: 2996 bytes --]
Variants of this appear repeatedly on #guix every now and then,
and also sometimes unasked by me not posted anywhere.
How do I run compile a package, computed-file or more generally a
lowerable object from the REPL? Let's look in the manual:
> Note that the ‘(guix monad-repl)’ module extends the Guile REPL with
> new “meta-commands” to make it easier to deal with monadic
> procedures: ‘run-in-store’, and ‘enter-store-monad’. The former is
> used to “run” a single monadic value through the store:
>
> scheme@(guile-user)> ,run-in-store (package->derivation hello)
> $1 = #<derivation /gnu/store/...-hello-2.9.drv => ...>
>
Um, I want the actual store item, not the derivation, and I'm looking
into lowering a non-package, let's look elsewhere:
> As it turns out, the call to ‘package->derivation’ can even be
> omitted since it will take place implicitly, as we will see later
> (*note G-Expressions::):
>
> (define (sh-symlink)
> (gexp->derivation "sh"
> #~(symlink (string-append #$bash
> "/bin/bash")
> #$output)))
>
> Calling the monadic ‘sh-symlink’ has no effect. As someone once
> said, “you exit a monad like you exit a building on fire: by
> running”. So, to exit the monad and get the desired effect, one must
> use ‘run-with-store’:
>
> (run-with-store (open-connection) (sh-symlink))
> ⇒ /gnu/store/...-sh-symlink
Let's try this (using the REPL command):
scheme@(guix-user)> ,run-in-store (plain-file "foo" "bar")
While executing meta-command:
Wrong type to apply: #<<plain-file> name: "foo" content: "bar"
references: ()>
doesn't work, let's try the 'lower-object' procedure which I vaguely
recall to helped me out in the past but doesn't have any actual
examples in the manual:
scheme@(guix-user)> ,run-in-store (lower-object (plain-file "foo" "bar"))
$15 = "/gnu/store/798sxvdgr0680czdggbls7rd3sfwk2yx-foo"
This looks useful, let's try it for mixed-text-file:
scheme@(guix-user)> ,run-in-store (lower-object (mixed-text-file "foo"
"bar"))
$17 = #<derivation /gnu/store/ah3yfw0nvw6jaif56r121sgwjiygmvrk-foo.drv
=> /gnu/store/raihpcxdz6wmdpyj67bwd4bjk02xq0x3-foo 7f862e53f820>
nooo there's the #<derivation ...> again how do I get a compiled mixed-
text-file from the REPL?
(I mean I could use 'build-derivations' from (guix)The Store, but that
accepts a list, not an individual derivation, and it doesn't accept strings
according to the documentation so it cannot be used for the 'plain-file'
and aren't derivations a super-low-level thing for which G-exps and such
were intended to make the low level thing almost an implementation detail?)
Seems like we are missing a general & documented & simple to use
'lower-object-completely' (or maybe 'compile-object'?) procedure for
this ... And maybe also a ,build-object REPL command?
Greetings,
Maxime.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
next reply other threads:[~2022-06-20 21:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-20 21:01 Maxime Devos [this message]
2022-07-03 20:50 ` bug#56114: Guix does not have a documented general and practical procedure for lowering a single lowerable object to the /gnu/store/... string Ludovic Courtès
2022-07-04 15:43 ` zimoun
2022-07-04 20:13 ` Ludovic Courtès
2022-07-04 21:59 ` zimoun
2022-07-05 7:57 ` Ludovic Courtès
2022-07-05 10:13 ` zimoun
2022-07-10 20:03 ` Joshua Branson via Bug reports for GNU Guix
2022-07-15 15:41 ` Ludovic Courtès
2022-07-19 14:10 ` Maxime Devos
2022-07-07 22:25 ` jbranso--- via Bug reports for GNU Guix
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1652a111d71c3e74c61904f89120ea45631c7013.camel@telenet.be \
--to=maximedevos@telenet.be \
--cc=56114@debbugs.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 public inbox
https://git.savannah.gnu.org/cgit/guix.git
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).