[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question about package environment variables
From: |
Thompson, David |
Subject: |
Re: Question about package environment variables |
Date: |
Wed, 18 May 2016 14:33:31 -0400 |
On Wed, May 18, 2016 at 2:24 PM, Matthew Jordan
<address@hidden> wrote:
> Good Day everyone,
>
> I would like to know is it possible to set any environment variable to
> any value from guix package. The usecase I am thinking of is for a
> project. Let's say you had a guix package file to automate and document
> project dependencies.
>
> Let's say I wanted to declare a variable in project package file so that
> "eval `guix environment --search-paths ...`" would set up the
> environment with the needed variables plus the ones I wanted.
>
> Example environment variable;
>
> export MSG='Hello world!'
See the 'native-search-paths' field of package objects. From
environment variables that aren't search paths, like the above $MSG,
those have nothing to do with packages so they wouldn't need to use
anything from Guix at all.
Also, why the use of 'eval' here? Just 'guix environment my-package'
would spawn a shell (or any program you wanted) with access to the
package's dependencies.
I use this all the time in my personal projects, where I keep a
'guix.scm' file in the root of the source tree that I can make
environment's from like so:
guix environment -l guix.scm
Additionally, I can also build and/or install development snapshots:
guix build -f guix.scm
guix package -f guix.scm
Here's a full example:
https://git.dthompson.us/haunt.git/blob/HEAD:/guix.scm
Hope this helps!
- Dave