On Sat, Jan 15, 2022 at 10:19:54PM -0500, Matt wrote:
> As I understand it, $HOME is set to /homeless-shelter during build because 
> that's how Nix does/did it and "there’s no home
> directory in build environments, and perhaps Eelco Dolstra and others back 
> then found that setting ‘HOME’ to a non-existing directory broke
> fewer builds that leaving it unset."

A further rationale is that by using an obviously strange and bogus
value for $HOME, all uses of $HOME in the build container are
highlighted.

Otherwise, if $HOME was unset, build scripts might fall back to
something like $HOME/$USER.

To be clear, the situation is not simply that "there's no home directory
in the build environment". Rather, there must not be a home directory
there. By design, that's a small part of how we ensure that builds are
deterministic.

In all cases, package builds should not be able to depend on the
pathname of a home directory.

> Is this something that should be documented, and if so, where?

It could be documented briefly in the manual section Build Environment
Setup.

Reply via email to