[Nix-dev] Generated path names within a derivation
Waisbrot, Nathaniel J. (Cont, ARL/CISD)
nathaniel.waisbrot at arl.army.mil
Tue Jun 9 16:38:54 CEST 2009
> 2) To solve your problem you can concatenate the path with a string.
> Unfortunately, I am not sure this will recompile the package if its
> patch changes.
>
> patches = [ (./ + "/${version}.patch") ];
patches = [ (./. + "/${version}.patch") ];
is a more concise form of what I was doing before. Unfortunately, it
does not pull the file into the store, and therefore does not recompile
when the patch changes.
> 3) If the solution (2) does not recompile when the content of the
> patch file change, then I'll suggest you to generate for each patch a
> small nix expression which contains the relative path to the patch:
OK, this answers my question then. Any files that I want Nix to copy
into the store automagically must be named directly, not computed.
I've got a kludge-around that appears to do what I want:
iFile = builtins.readFile "/nix/nixpkgs/foo/${version}.patch";
oFile = builtins.toFile "${version}.patch" iFile;
patches = [ oFile ];
1) Nix reads the computed patch file's contents into a variable
2) Nix write the contents of that variable back into the store
3) Nix references the file in the store as a patchfile
Nix notices updates here, I assume because I'm able to force all
variables to be evaluated before we reach the builder.
Thanks for the help!
--
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4276 bytes
Desc: not available
Url : http://lists.science.uu.nl/pipermail/nix-dev/attachments/20090609/2da95479/attachment.bin
More information about the nix-dev
mailing list