all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* why does '-e' work differently in guix shell and guix package?
@ 2023-12-26 10:48 Alexander Asteroth
  2024-02-15 16:47 ` Simon Tournier
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Asteroth @ 2023-12-26 10:48 UTC (permalink / raw)
  To: help-guix

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?

Cheers
Alex

PS: reason I'm trying that is, that the recent pytorch-version 
installed via pip complains about not finding libstdc++ which is 
in the lib output of the superseeded gcc package and I thought 
this might resolve my problem. 


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: why does '-e' work differently in guix shell and guix package?
  2023-12-26 10:48 why does '-e' work differently in guix shell and guix package? Alexander Asteroth
@ 2024-02-15 16:47 ` Simon Tournier
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Tournier @ 2024-02-15 16:47 UTC (permalink / raw)
  To: Alexander Asteroth, help-guix

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-15 17:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-26 10:48 why does '-e' work differently in guix shell and guix package? Alexander Asteroth
2024-02-15 16:47 ` Simon Tournier

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.