unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: "Thompson, David" <dthompson2@worcester.edu>
To: Matthew Jordan <matthewjordandevops@yandex.com>
Cc: Help Guix <help-guix@gnu.org>
Subject: Re: Question about package environment variables
Date: Wed, 18 May 2016 14:33:31 -0400	[thread overview]
Message-ID: <CAJ=RwfbWXe=TMFXqwr3HizDJiUgCEsFyWE4M-NcCfNavfXmiow@mail.gmail.com> (raw)
In-Reply-To: <87posjxm0i.fsf@mailerver.i-did-not-set--mail-host-address--so-tickle-me>

On Wed, May 18, 2016 at 2:24 PM, Matthew Jordan
<matthewjordandevops@yandex.com> 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

  reply	other threads:[~2016-05-18 18:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-18 18:24 Question about package environment variables Matthew Jordan
2016-05-18 18:33 ` Thompson, David [this message]
2016-05-18 20:23   ` Matthew Jordan
2016-05-18 20:30     ` Thompson, David
2016-05-18 20:44       ` Matthew Jordan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJ=RwfbWXe=TMFXqwr3HizDJiUgCEsFyWE4M-NcCfNavfXmiow@mail.gmail.com' \
    --to=dthompson2@worcester.edu \
    --cc=help-guix@gnu.org \
    --cc=matthewjordandevops@yandex.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).