bug-guix
[Top][All Lists]
Advanced

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

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


From: zimoun
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, 04 Jul 2022 17:43:22 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hi,

If I read correctly, this snippet from the manual,

>>      scheme@(guile-user)> ,run-in-store (package->derivation hello)
>>      $1 = #<derivation /gnu/store/...-hello-2.9.drv => ...>

becomes

    scheme@(guile-user)> ,lower hello

and this snippet,

> scheme@(guix-user)> ,run-in-store (lower-object (plain-file "foo" "bar"))
> $15 = "/gnu/store/798sxvdgr0680czdggbls7rd3sfwk2yx-foo"

becomes

    scheme@(guile-user)> ,build (plain-file "foo" "bar")


However, note that,

--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> ,build (plain-file "foo" "bar")
$1 = "/gnu/store/798sxvdgr0680czdggbls7rd3sfwk2yx-foo"
scheme@(guix-user)> ,lower (plain-file "foo" "bar")
$2 = "/gnu/store/798sxvdgr0680czdggbls7rd3sfwk2yx-foo"
--8<---------------cut here---------------end--------------->8---

which is confusing, especially when,

--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> ,lower (mixed-text-file "foo" "bar")
$6 = #<derivation /gnu/store/40982nzm6c7n4yawvs3m39k313jsrl80-foo.drv => 
/gnu/store/raihpcxdz6wmdpyj67bwd4bjk02xq0x3-foo 7f6f9bc5cd20>
scheme@(guix-user)> ,build (mixed-text-file "foo" "bar")
$7 = "/gnu/store/raihpcxdz6wmdpyj67bwd4bjk02xq0x3-foo"
--8<---------------cut here---------------end--------------->8---


The issue – unrelated to the nice patch – is a potential “inconsistency”
between ’<plain-file>’ and ’<computed-file>’; ’plain-file’ refers to
’text-file’ and ’mixed-text-file’ refers to ’text-file*’; and both are
really different despite close names around. :-)

Maybe the docstring of ’plain-file’ and of ’mixed-text-file’ could be
extended.  For instance,

--8<---------------cut here---------------start------------->8---
(define (plain-file name content)
  "Return an lowered object representing a text file called NAME with the given
CONTENT (a string) to be added to the store.

This is the declarative counterpart of 'text-file'."
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
(define* (mixed-text-file name #:key guile #:rest text)
  "Return an object representing store file NAME containing TEXT.  TEXT is a
sequence of strings and file-like objects, as in:

  (mixed-text-file \"profile\"
                   \"export PATH=\" coreutils \"/bin:\" grep \"/bin\")

This is the declarative counterpart of 'text-file*' but note that a
'computed-file' object is returned."
--8<---------------cut here---------------end--------------->8---



> diff --git a/guix/monad-repl.scm b/guix/monad-repl.scm
> index aefabdeebb..15c10efe01 100644
> --- a/guix/monad-repl.scm
> +++ b/guix/monad-repl.scm
> @@ -1,5 +1,5 @@

All LGTM.


> +(define* (evaluate/print-with-store mvalue #:key build?)
> +  "Run monadic value MVALUE in the store monad and print its value."

I do not know if it makes sense to have a list of monadic values,
allowing something like:

    ,build hello coreutils



Cheers,
simon





reply via email to

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