From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Thompson, David" Subject: Re: Question about package environment variables Date: Wed, 18 May 2016 14:33:31 -0400 Message-ID: References: <87posjxm0i.fsf@mailerver.i-did-not-set--mail-host-address--so-tickle-me> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49915) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b36Hm-0000gb-3Q for help-guix@gnu.org; Wed, 18 May 2016 14:33:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b36Hj-0006SA-Uc for help-guix@gnu.org; Wed, 18 May 2016 14:33:33 -0400 Received: from mail-yw0-x229.google.com ([2607:f8b0:4002:c05::229]:35321) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b36Hj-0006Rx-Ok for help-guix@gnu.org; Wed, 18 May 2016 14:33:31 -0400 Received: by mail-yw0-x229.google.com with SMTP id g133so57035443ywb.2 for ; Wed, 18 May 2016 11:33:31 -0700 (PDT) In-Reply-To: <87posjxm0i.fsf@mailerver.i-did-not-set--mail-host-address--so-tickle-me> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane.org@gnu.org Sender: "Help-Guix" To: Matthew Jordan Cc: Help Guix On Wed, May 18, 2016 at 2:24 PM, Matthew Jordan 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