[Nix-dev] Re: Re: ${out}

Nicolas Pierron nicolas.b.pierron at gmail.com
Sun Apr 11 23:23:44 CEST 2010


Hi,

On Sun, Apr 11, 2010 at 17:49, Yury G. Kudryashov <urkud+nix at ya.ru> wrote:
> Sorry, I should've write the proposal in more details in the first message.
> I know that nix language cannot replace ${out}. I think that I've found a
> good workaround for this problem.

I am not sure to get your point.

In a derivation, if you write:

  configurePhase = "... ${out} ...";

you will have a problem because the variable 'out' is look in the Nix
expression.  So it won't find it.

If you write one of the following:

  configurePhase = "... $out ..."; # shell: ... $out ...
  configurePhase = "... "${out} ..."; # shell: .. ${out} ...

you should get the access to a shell variable "out".  This variable is
defined to the outPath of the derivation when the default builder is
used.  You may remark that escaping the '$' symbol is done with the
string delimiter, not '\'.

> >From nix-build(1):
>    nix-build is essentially a wrapper around
>        nix-instantiate (to translate a high-level Nix expression to a
>            low-level store derivation) and
>        nix-store --realise (to build the store derivation).
>
> If the proposal will be accepted, one will be able to write
> derivation { configureFlags="--with-plugins=\${out}/lib/plugins"; }
> ("\${out}", not "${out}").
>
> nix-instantiate will write to the derivation file:
> configureFlags="--with-plugins=${out}/lib/plugins"
>
> $out will be calculated using this string, not /nix/store/path/lib/plugins.
>
> nix-store --realise will replace ${out} with /nix/store/path before setting
> configureFlags environment variable for the builder.

$out does not work in configureFlags, due to some tricks inside the
generic builder, I would prefer to fix the generic builder instead of
adding a special case.

The problem I see with the substitution of ${out}, is that we are
expecting to write shell script, not a super language containing shell
script where some part of the shell script semantic is reinterpreted.
If you intend to substitute ${out}; then you may consider all use
cases.

-- 
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron - http://nbp.name/



More information about the nix-dev mailing list