guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Export environment variables only in `guix environment`.


From: Chris Marusich
Subject: Re: Export environment variables only in `guix environment`.
Date: Thu, 01 Feb 2018 18:26:57 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Fis Trivial <address@hidden> writes:

> * Problem
> The exported environment variables can cause various problems in foreign
> distribution(1)(2). And besides, The long list of environment variables(4)
> injected into user's login shell makes the user's environment impure.

A lot of software is intended to be dynamically composed with other
software at run-time through the use of mechanisms like environment
variables.  Other mechanisms of dynamic composition at run-time also
exist, such as configuration files (e.g., ~/.emacs).  Consider the
EDITOR environment variable, which is traditionally used to indicate the
user's default text editor.  We COULD try to control the EDITOR
environment variable with Guix, but then you would have to update your
Guix profile every time you wanted to change your default text editor.
It would be "more pure," but less convenient.

To a certain extent, I think it is desirable (and unavoidable?) to use
these mechanisms to dynamically configure and compose software.
However, sometimes you can still let Guix control the environment
variables without making it inconvenient, and without letting the
environment variables set by Guix "leak" into the user's environment.
For example, you can wrap programs in a script that sets their
environment variables explicitly, rather than relying on the environment
variables being set correctly by the user.  Guix does this already for a
variety of packages (see the "asunder" package for a simple example).

For more information, check out section 7.1.1 "Principles" of the the
Nix thesis [1].  The entire section surrounding that phrase is also relevant
and interesting.

Footnotes: 
[1]  https://nixos.org/~eelco/pubs/phd-thesis.pdf

-- 
Chris

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]