[Nix-dev] Generated path names within a derivation

Nathaniel Waisbrot (Cont ARL/CISD) nathaniel.waisbrot at arl.army.mil
Mon Jun 8 20:36:09 CEST 2009


I'm interested in writing a single 'default.nix' for multiple versions
of a package.  Each version has unique patch needs, so I'd like to use
the following (pseudo-Nix):

{stdenv, version}:
stdenv.mkDerivation {
 ...
 patches = [ ./${version}.patch ];
 ...
};


(That's not syntactically valid Nix.)  Is it possible to do what I want
here?  What's the correct way to do it?



We've tried

dir = ./.;
patches = [ (toPath "${dir}/${version}.patch") ];

but that causes the entire directory to be copied into the store, so
that if one patch is changed, all versions will need a rebuilt.


We've also tried

patches = [ (toPath ((toString ./.) + "/${version}.patch")) ];

but this doesn't notice when the patch-file has changed at all.


-- 
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