Subject: bug#42164: Combining file-append with gexps results in incomprehensible errors

From: Brian Cully <[email-masked]>
Date: Sun, 24 Apr 2022 19:27:11 -0400

Maxime Devos <[email-masked]> writes:

> Nowhere.  I tried implementing 'output', and noticed I just 
> ended up
> with something equivalent to a simple call to 'gexp-input' 
> (hence,
> ‘this thing already exists’).  'gexp-input' can be found in 
> (guix
> gexp).

	I finally had a chance to mess around with this, and it 
	does, indeed, do the job. Since it wasn’t clear to me how 
	it worked, I’d like to document it here.

	To accomplish the goal at the begging of this thread, 
	rather than using:
--8<---------------cut here---------------start------------->8---
(file-append #~#$gcc:lib “/lib”)
--8<---------------cut here---------------end--------------->8---

	The “correct” way is this:
--8<---------------cut here---------------start------------->8---
(gexp-input (file-append gcc "/lib") "lib")
--8<---------------cut here---------------end--------------->8---

	The name seems a little weird, since we’re selecting an 
	output, but it makes sense from the other end: we’re 
	creating an input for the higher-level expression (in this 
	case, the special-file-services-type).

	Anyway, this works for me, so this ticket can probably be 
	closed.

-bjc