Subject: Re: bug#59071: guix home does not respect package outputs

From: Ludovic Courtès <[email-masked]>
Date: Thu, 10 Nov 2022 10:54:13 +0100

Hi,

[email-masked] skribis:

> This should be a good enough reproducer:
>
> ```
> (home-environment
>   (packages
>     (map specification->package+output
>       (list "glib:bin"
>             ...)))
>   ...)
> ```

‘specification->package+output’ returns two values:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (specification->package+output "glib:bin")
$38 = #<package [email-masked] gnu/packages/glib.scm:445 7f0988d69b00>
$39 = "bin"
--8<---------------cut here---------------end--------------->8---

However, ‘map’ expects its first argument to return one value and thus
discards additional values:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (map specification->package+output '("glib:bin"))
$40 = (#<package [email-masked] gnu/packages/glib.scm:445 7f0988d69b00>)
--8<---------------cut here---------------end--------------->8---

Instead, you have to write ‘specifications->packages’:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (specifications->packages '("glib:bin" "inkscape"))
$42 = ((#<package [email-masked] gnu/packages/glib.scm:445 7f0988d69b00> "bin") (#<package [email-masked] gnu/packages/inkscape.scm:244 7f097cf246e0> "out"))
--8<---------------cut here---------------end--------------->8---

That’s what ‘guix home import’ does now, but I noticed it’s not
documented so I’ll add it to the manual.

Thanks,
Ludo’.