[Nix-dev] Generated path names within a derivation

Nathaniel Waisbrot (Cont ARL/CISD) nathaniel.waisbrot at arl.army.mil
Mon Jun 8 21:59:18 CEST 2009


I ought to have mentioned I'm using Nix 0.12.


On Mon, 2009-06-08 at 22:53 +0400, Michael Raskin wrote:
> Try to copy selectVersion approach



Thanks for the reply, but I don't think I understand you.  Could you be
more explicit?

I'm trying to produce the same effect as this:

patches = [ ./1.0.patch ];

except that I want the file name to be computed at evaluation time.



selectVersion uses an 'import' statement to evaluate Nix code at a path.
I don't want to do that; I want to copy a specific file into the store
as a input for a derivation.


I tried the following:

  getFile = dir: file: (toPath "${dir}/${file}");
  aFile = getFile "/nix/nixpkgs/networks"    "${version}.patch";
  patches = [ aFile ];

in the hopes that just wrapping things inside of a function would trick
Nix into evaluating it as a known path.
No dice; "cannot coerce a function to a string" when evaluating the
first line.  (I don't see what function it's trying to coerce...)


-- 
Nathaniel Waisbrot
Software Dev Analyst
Lockheed Martin / ARL DoD Supercomputing Resource Center
Adelphi Laboratory Center, MD 20783
Phone:  301-394-0096
Fax:    301-394-2279
Email:  nathaniel.waisbrot at arl.army.mil



More information about the nix-dev mailing list