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

Michael Raskin 7c6f434c at mail.ru
Fri Dec 19 17:45:53 CET 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Marc Weber wrote:
> real life. I'd vote for composableDerivation..

1. You are biased.
2. We would better define interface first, not the implementation.

>     libXDefaultOptsAndFun = {
>       fun = opts : stdenv.mkDerivation { ... };
>       defaultOpts = { .. };
>     };
>     X= libXDefaultOptsAndFun.fun libXDefaultOptsAndFun.defaultOpts;
> 
> 
>     prog = import .. {
>       inherit libXDefaultOptsAndFun;
>     };

Is it me or is it not more complicated than composableDerivation approach?

>     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 ;  })];
>       ...
>     }

Well, looks like overkill for the most common case without being a
silver bullet for theoretically supporting large changes while still
using everything still useful from default configuration.

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

If you still have a check, what's the point?

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

My proposal can be further simplified.

== all-packages.nix ==
prog = composedArgsAndFun (import ...) {
  inherit libX libY;
  xSupport = true;
  ySupport = false;
}
== prog-user.nix ==
{
  prog = prog.passthru.function {
    ySupport = true;
  };
}
==

Note that in that case we can omit checks - xSupport stays untouched. Of
course, there are some corner cases. composedArgsAndFun still allows to
override everything, but it can become tricky no matter how do you do it.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQEcBAEBAgAGBQJJS8/AAAoJEE6tnN0aWvw3HMsH/A7rwvWBSeIUkEGKGtEAP+5B
Cn2H4+tt+pjH+8n5LD9oD/fRyQ4AOVm6tAeoyyhBvvP1qH4LXRQoDHEpFE7nqxef
c3wdmde7rBLrf9BLHhJMKsWYkb27kA0CLMhYx7pv5O0Wv+O/ZYiTssBpdMvApsxc
gBFrl+ac9NnMOeaAV7+Ij3tQsoDYhHnMNDTBGQsTcUCB4VzfuMwjvmc9aib/5pM5
CR2dwszfbjoH6eeCXhgzcBWA4zJxOG5SFZhRKTHFQmuxxPgzcPC5Ke22Qd59Xeya
8nwFewqnoKdVKpJC6AxDXNyu1epBgL2aYmQCqV3x00gNBES7a4FrLoWnINdQsdk=
=drla
-----END PGP SIGNATURE-----



More information about the nix-dev mailing list