[Nix-dev] Handle runtime dependencies

Wouter db uu at denbreejen.net
Mon Mar 17 13:03:22 CET 2008


Nicolas Pierron schreef:
> On Mon, Mar 17, 2008 at 1:11 AM, Wouter db <uu at denbreejen.net> wrote:
>   
>>  I don't get why you don't want to recompile when runtime dependencies
>>  change, they seem just as important to me as build time dependencies.
>>     
>
> Because they do not interact in the compilation process and they only
> interact in the in the wrapper generation. So it is useless to compile
> again the same things (that kills bears).
>
>   
I get your idea, but with really runtime dependencies, you do not need 
to feed them to the component expression at all (since the component 
does not use these dependencies at build time anyway), so you only 
declare them in the wrapper.

A change in runtime dependencies will only generate a new wrapper.

>>  Don't you loose purity (dependablility) by this?
>>     
>
> I don't see where I could loose purity. In fact the reason of
> build-time dependencies is that it is not checked at compile time but
> needed at runtime, so the package is already impure. Separating
> build-time dependencies from the other part of the compilation is not
> necessary except if you don't want to recompile the world each time a
> small used package change.
>   
>>  Nicolas Pierron schreef:
>>
>>
>>     
>>> Hi,
>>>       
>>  >
>>  > I have found a way to handle runtime dependencies which offer the
>>  > opportunity to not recompile a program if its runtime dependencies
>>  > have changed.The following code handle a new attribute
>>  > (runtimeDependencies) inside mkDerivation. This attribute contains a
>>  > derivation which has as source (src) the "clean" installed version.
>>  >
>>  >   addRuntimeDependenciesToDerivation = stdenv: stdenv //
>>  >     { mkDerivation = args:
>>  >         if args ? runtimeDependencies then
>>  >           stdenv.mkDerivation ({
>>  >             meta = args.meta;
>>  >             name = args.name;
>>  >             src = stdenv.mkDerivation (removeAttrs args
>>  > ["runtimeDependencies"]);
>>  >           } // args.runtimeDependencies)
>>  >         else
>>  >           stdenv.mkDerivation args
>>  >         ;
>>  >     };
>>  >
>>  > It is use as follow:
>>  >
>>  > { ... }:
>>  >
>>  > stdenv.mkDerivation rec {
>>  >   name = "...";
>>  >   src = fetchurl { ... };
>>  >
>>  >   runtimeDependencies = {
>>  >      buildInputs = [ ... ];
>>  >
>>  >      buildCommand = '' ... '';
>>  >   };
>>  >
>>  >   meta = { ... };
>>  > }
>>  >
>>  > Should I commit this?
>>  >
>>  >
>>
>>
>>     
>
>
>
>   




More information about the nix-dev mailing list