Subject: [bug#53447] Introducing ‘GUIX_’-prefixed environment variables

From: Ludovic Courtès <[email-masked]>
Date: Wed, 26 Jan 2022 13:05:07 +0100

Hi,

Maxim Cournoyer <[email-masked]> skribis:

> Ludovic Courtès <[email-masked]> writes:
>
>> Hi,
>>
>> Maxim Cournoyer <[email-masked]> skribis:
>>
>>> I like to see this as a bug, so I've opened one as 53514; Guix should
>>> strive to not mess with the host environment, and setting global
>>> variables used by both Guix and a potentially foreign host goes against
>>> this.  The proper fix would be to patch all applications in Guix to use
>>> Guix-specific variables, such as GUIX_XDG_DATA_DIRS instead of
>>> XDG_DATA_DIRS.
>>
>> This approach has its appeal (like in the ‘GUIX_PYTHONPATH’ case), but
>> there’s a tension with our other unwritten (?) guideline that we should
>> modify packages as little as possible.
>>
>> Such wide-ranging changes would have the unfortunate effect that they’d
>> make Guix packages “special”: documentation, bug reports, suggestions
>> you’d find online would apply to the “real” package, but maybe not to
>> the Guix one.  That is a situation we’d rather avoid IMO.
>
> True; but after people would get a hang that in Guix most environment
> variables would be prefixed with 'GUIX_', I don't think it'd be that big
> of an issue.  Maintaining the patches would be where the burden would
> lie, in my opinion.

There are environment variables everywhere; are you suggesting to
GUIX_-prefix them en masse?

That seems neither viable nor desirable to me.  And, as Liliana put it,
when will we have GUIX_PATH?  :-)

>> ‘XDG_DATA_DIRS’ is a real problem though.  In large part that’s because
>> its purpose is too broad—what “data dirs” are we talking about?  It
>> would be ideal if we could progressively replace ‘XDG_DATA_DIRS’ search
>> path specifications with more specific environment variables, when they
>> exist, or perhaps by using ‘wrap-program’ instead of having search path
>> specs.
>
> Are there any more specific environment variables that exist that can
> replace XDG_DATA_DIRS?  I'm not too knowledgeable about the freedesktop
> specs, but I'm somewhat skeptical?  If they don't yet exist, that makes
> this idea much less actionable.

I don’t know.  Like I wrote, the two main cases are glib and qt.  Why do
we have them use XDG_DATA_DIRS for?  This is what we need to
investigate.

I would be less reluctant to patches that add an extra variable in these
two packages (which could be submitted upstream) than GUIX_-prefixing
it.

Ludo’.