[Nix-dev] deepOverride

Eelco Dolstra e.dolstra at tudelft.nl
Fri Jul 9 17:48:48 CEST 2010


Hi,

On 07/09/2010 05:30 PM, Michael Raskin wrote:

> On 07/09/2010 03:37 PM, Eelco Dolstra wrote:
>>   pan_with_gtk216 =
>>     (pkgsFun { gtkLibs = gtkLibs216; }).pan;
> 
> OK, it seems nice that way. Except I don't see how it will work in the
> worse use case.
> 
> Let the libsoup release we want for most packages be x (stable) , for
> libA it is more like y (development) and for libB that uses libA - and
> wants version z (git snapshot).

I'm not sure if this double override scenario occurs often in practice, but I
guess you can do something like this:

  libA = import .../libA {
    libsoup = libsoup_y;
  };

  libB =
    let pkgs = pkgsFun { libsoup_y = libsoup_z; }; in
    import .../libB {
      inherit (pkgs) libA;
    };

However, the "libsoup_y = libsoup_z" is rather ugly and brittle.

If no deep override is needed, I would just do

  libB = import ../libB {
    libA = import ../libA {
      libsoup = libsoup_z;
    };
  };

or

  libA = makeOverridable (import .../libA) {
    libsoup = libsoup_y;
  };

  libB = import ../libB {
    libA = libA.override {
      libsoup = libsoup_z;
    };
  };

-- 
Eelco Dolstra | http://www.st.ewi.tudelft.nl/~dolstra/



More information about the nix-dev mailing list