Subject: bug#75822: guix home/system don't report errors in loaded modules

From: 45mg <[email-masked]>
Date: Sat, 25 Jan 2025 07:44:25 +0000

Attached is a tarball that can be used to minimally reproduce the issue.

There are two files - test-home.scm and test-home-packages.scm. The
latter defines and exports `%my-packages`, but before it's defined, line
5 has an error.

--8<---------------cut here---------------start------------->8---
$ guix home build -L . test-home.scm 
ice-9/eval.scm:223:20: In procedure proc:
error: %my-packages: unbound variable
hint: Did you forget `(use-modules (test-home-packages))'?
--8<---------------cut here---------------end--------------->8---

I would expect to see a report of the error on line 5, but that doesn't
happen. `guix system` behaves the same way.

This becomes extremely annoying once you have a large configuration
split up between separate files, because if you make a mistake in any
file except the one being passed to `guix home` or `guix system`, you
don't see the error message for it.