[Nix-dev] Re: warning if trying to install a package but it fails an assert.

Marc Weber marco-oweber at gmx.de
Fri Dec 19 17:26:03 CET 2008


On Fri, Dec 19, 2008 at 04:09:45PM +0100, Andres Loeh wrote:
> Yes, I agree that the default for subversion should be *with*
> perl bindings.
> 
> In general, as Marc explained as well, there's indeed no problem
> to the "check if the requirements are met by the defaults" scheme,
> though. I'll try to explain it conceptually, not based on passthru:
> 
> Currently, we're mostly passing complete derivations (let's say,
> because I like types, of type DERIVATION) into the Nix
> expressions for individual packages. These have a fixed set of
> options hard-wired at the time they're passed. Instead of doing
> that, let's pass the actual function, of type
> (OPTIONS -> DERIVATION) plus a set of default options (of type
> OPTIONS). The individual package can then decide whether to just
> go with the default options (by applying the function to the
> options), or if to modify the options before applying.

Hi Andres.

I think at least those people who has contributed to this discussion do
agree on this that it would be best to pass the default options and the
functions. So I'd like to discuss which is the best way to do this in
real life. I'd vote for composableDerivation..

So you end up writing this?

all-packages.nix:

    libXDefaultOptsAndFun = {
      fun = opts : stdenv.mkDerivation { ... };
      defaultOpts = { .. };
    };
    X= libXDefaultOptsAndFun.fun libXDefaultOptsAndFun.defaultOpts;


    prog = import .. {
      inherit libXDefaultOptsAndFun;
    };
    
  ========== prog.nix ==================
  args; with args;
  stdenv.mkDerivation {
    ...
    buildInputs = [ (libXDefaultOptsAndFun.fun libXDefaultOptsAndFun.defaultOpts) ];
    ...
  }


?
This really makes my brain hurt knowing that we the passthru solution
does work very well and supports this all easily: 

    libX = composableDerivation {
      initial = {
        # default stuff you pass to composableDerivation 
        flags = { x = .. };
        cfg = { xSupport = true;  };
      };
    };

    prog = import .. {
      libX
    }

    ========== prog.nix ==================
    args; with args;
    stdenv.mkDerivation {
      ...
      buildInputs = [ libY (libX.passthru.funChangeConfig { xSupport = false ;  })];
      ...
    }

Note that a libY can be passed without applying options. This is the
common case. Changing options is the exception, isn't it?

Andres, could you think about how code should look like providing
your proposed features? I've given my suggestion here. Maybe you still
can find a better way?

Sincerly
Marc Weber



More information about the nix-dev mailing list