emacs-bug-tracker
[Top][All Lists]
Advanced

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

bug#56114: closed (Guix does not have a documented general and practical


From: GNU bug Tracking System
Subject: bug#56114: closed (Guix does not have a documented general and practical procedure for lowering a single lowerable object to the /gnu/store/... string.)
Date: Fri, 15 Jul 2022 15:42:02 +0000

Your message dated Fri, 15 Jul 2022 17:41:40 +0200
with message-id <87o7xq5qob.fsf@gnu.org>
and subject line Re: bug#56114: Guix does not have a documented general and 
practical procedure for lowering a single lowerable object to the 
/gnu/store/... string.
has caused the debbugs.gnu.org bug report #56114,
regarding Guix does not have a documented general and practical procedure for 
lowering a single lowerable object to the /gnu/store/... string.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
56114: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56114
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: 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 User-agent: Evolution 3.38.3-1
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: signature.asc
Description: This is a digitally signed message part


--- End Message ---
--- Begin Message --- Subject: Re: bug#56114: Guix does not have a documented general and practical procedure for lowering a single lowerable object to the /gnu/store/... string. Date: Fri, 15 Jul 2022 17:41:40 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux)
Hi!

Thanks all for your support.  :-)

I’ve pushed these new REPL commands as
4ce7f1fb24a111f3e92d5b889d1271bebf109d09, including a new “Using Guix
Interactively” section in the manual to document it.  Feedback welcome!

I’m sure we can add more REPL commands as we better see what useful
shorthands would be welcome.

Cheers,
Ludo’.


--- End Message ---

reply via email to

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