[Nix-dev] multiple-output derivations

Yury G. Kudryashov urkud+nix at ya.ru
Thu Apr 22 19:45:24 CEST 2010


Hi!

Today we've disscussed multiple-output derivations on IRC, and found out 
quite a few problems. I'll try to sum it up. The intention of my answers is 
to obtain some "minimal usable" configuration. In this configuration 
splitting will be used only for big projects, or for non-essential parts 
like documentation. Splitting into "shared libs", "binaries" and 
"development files" would be more tricky.

Q: What should nix do if one of the outputs already exists (say, I've pulled 
this output as a dependency, or other were garbage-collected)?

A: We can use chroot builds, and ignore already existing paths.

Q: nix-language API

A: For example, derivation primop can take "outputs" array argument, and add 
outs = { out = out; outputs[0] = ...; ...} attribute to the result. Each 
output should be marked as a derivation.

Q: How should nix guess that ".dev" output needs ".lib" output?

A: nix-expr author should specify it manually for now. Probably, we should 
change the syntax from the previous question into the following:

derivation {
outs = rec {
bin = { depends = [ lib ]; };
lib = {};
dev = { depends = [ bin lib ]; };
};
}

Of course, circular dependencies must be avoided in this case.

Q: What should we add when someone says buildInputs = [ somelib ]?

A: Only "main" output.

Q: Should stdenv.mkDerivation automatically split every single package into 
bin+include+lib+doc?

A: I think that we should first test the feature with a few splitted 
packages.

I'm nearly sure that I've missed something. Comments are welcome.




More information about the nix-dev mailing list