bug-guix
[Top][All Lists]
Advanced

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

Re: Toward 0.2


From: Ludovic Courtès
Subject: Re: Toward 0.2
Date: Wed, 20 Feb 2013 12:28:27 +0100
User-agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux)

Nikita Karetnikov <address@hidden> skribis:

>>  wrapProgram $out/bin/guile-snarf --prefix PATH : "${gawk}/bin"
>
> How can I get the output of a package?

With the recently-added ‘package-output’ (singular):

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (package-output s binutils "out")
$2 = "/nix/store/bfh5c2a4is27jdmc811fp6g0jfac7fiw-binutils-2.22"
scheme@(guile-user)> (package-output s binutils "lib")
$3 = "/nix/store/n29brzqlhjkzww51labk9anx493gl4d3-binutils-2.22-lib"
--8<---------------cut here---------------end--------------->8---

Under the hood it calls ‘package-derivation’, which does the actual
output path computation.

>>   #!/bin/sh
>>   export PATH="/nix/store/...-gawk/bin:$PATH"
>>   exec ./.guile-snarf-real "$@"
>
> Should it be saved as 'guile-snarf'?  And I have to use rename(2),
> right?

You first rename the wrapped program, then create the wrapper as above,
and finally chmod it so that it’s executable.

> What should I use to handle prefixes (e.g., a keyword, a simple
> argument)?  Should they be case insensitive?

Good question.  The thing is that sometimes you want to affect several
environment variables.  Maybe something like:

  (define* (wrap-program file #:rest variables)
     ...)

Where each rest argument has a form like this:

  ("PATH" ":" prefix ("/nix/.../foo/bin" "/nix/.../bar/bin"))

Instead of ‘prefix’, users could ask for ‘prefix’ (prepend to the search
path) or ‘=’ (set the search path to exactly that value.)

WDYT?

Ludo’.



reply via email to

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