[Nix-dev] Re: Re: ${out}
Jeff Johnson
n3npq at mac.com
Sun Apr 11 18:29:00 CEST 2010
On Apr 11, 2010, at 11:49 AM, Yury G. Kudryashov wrote:
> Jeff Johnson wrote:
>>> So I'd limit this to replacing $out only.
>> The problem of infinite recursion can/will reappear
>> no matter value ${out} has, as its intrinsic to lazy evaluation.
> 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.
>
>> 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.
>
OK. Let me make sure I understand your solution by attempting
to restate alternatively.
AFAICT, there are two evaluations of ${out} during nix-build,
one in nix-instantiate, the other in nix-store.
By "escaping", you are (in my words) forcing a single lazy evealuation.
A single (rather than two) evaluations of ${out} seems reasonable. Whether
this is done through escaping or some other means is perhaps more syntax
and aesthetics ...
But from what little I know of how Nix "works", there's likely a whole class
of path issues like this, not just ${out} <-> /nix/store/path/... evaluations.
E.g. let's assume that there's _BOTH_ /nix/store and /xiu/store that exist
as path prefixes, and one wants nix instances to be able to be moved
between /nix/store <-> /xiu/store with the same nix-hash value attached.
>From what little I know of how nix-hash without --flat "works", there
would seem to be many issues with replacing a leading "/nix/store/path/"
prefix with a variable like "\${out}" by delaying/escaping/postponing
the evaluation (no matter how that is accomplished, \${out} is just one way).
Is that the type of solution you are proposing using "\${out}" in nix-instantiate?
If yes, will the escaping generalize to the class of "/nix/store" <-> "/xiu/store"
prefixes with the freedom to move nix-hash instances between both prefixes?
And I apologize if I've totally misunderstood the \${out} issue. I'm pretty
new to Nix, still trying to get my head around functional programming.
73 de Jeff
More information about the nix-dev
mailing list