help-guix
[Top][All Lists]
Advanced

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

Re: why does '-e' work differently in guix shell and guix package?


From: Simon Tournier
Subject: Re: why does '-e' work differently in guix shell and guix package?
Date: Thu, 15 Feb 2024 17:47:12 +0100

Hi,

Well, I have missed if there is a reply.  In case not. :-)

On mar., 26 déc. 2023 at 11:48, Alexander Asteroth 
<alexander.asteroth@h-brs.de> wrote:
> When I do
> ```
> $ guix shell --network --container --emulate-fhs bash coreutils -e 
> '(list (@@ (gnu packages commencement) gcc) "lib")'
> ```
> I get a shell, that has `libstdc++.so.6` in `/lib`.
>
> But when I do
> ```
> $ guix package -e '(list (@@ (gnu packages commencement) gcc) 
> "lib")'
> guix package: error: expression "(list (@@ (gnu packages 
> commencement) gcc) \"lib\")" does not evaluate to a package
> ```
> I get an error. Why is that?

That’s because “guix shell” relies on ’read/eval’ and “guix package” on
’read/eval-package-expression’; both defined in the module (guix ui).

As you see,

--8<---------------cut here---------------start------------->8---
(define (read/eval-package-expression str)
  "Read and evaluate STR and return the package it refers to, or exit an
error."
  (match (read/eval str)
    ((? package? p) p)
    (x
     (leave (G_ "expression ~s does not evaluate to a package~%")
            str))))
--8<---------------cut here---------------end--------------->8---

“guix package” expects that the expression returns a ’package’ when it
returns a list.

Well, indeed it seems inconsistent and “guix package” could be updated
to also just use ’read/eval’.

Cheers,
simon



reply via email to

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