[Nix-dev] Re: Git expression

Peter Simons simons at cryp.to
Tue Jun 17 12:14:11 CEST 2008


Marc Weber writes:

 >> My preferred solution is to be able to choose, i.e. I would like to set
 >> a "doc" option in .nixpkgs/config.nix. How about the following approach?
 >>
 >> getConfig [ "git" "doc" ] (getConfig [ "doc" ] false)
 >>
 >> This way, users could set that 'doc' flag globally, but still override
 >> the setting per-package.
 >
 > Which setting should the buildfarm has then?

Well, the build farm uses whatever setting the maintainers of the build farm
choose to configure.

 > Should it build both so that we still can fetch binaries?

If the build farm is up to the task, yes, let it build both. Personally, I
don't care much for pre-build binaries. I want installed software compiled
with proper -march and -O3 settings, so my chances of being able to use a
pre-built binary are slim anyway.

For others, pre-build binaries are important and that's fine. If nix is a
success, I reckon that we'll have no shortage of volunteers who can provide
pre-build binaries for all kinds of platforms and build flag permutations.

 > So the best option would be:
 > Split each package into 2 or even three parts:
 > a) runtime stuff
 > b) documentation
 > c) dev stuff (header files and such)

I am sorry, but I don't agree. The best solution is to have _one_ package
that can be configured to support all available use cases. Once that exists,
it's trivial to define forwarder expressions that instantiate the generic
expression with appropriate options. A good example how that is done is
python:

  python25Fun = lib.sumArgs (import ../development/interpreters/python/2.5) {
    inherit fetchurl stdenv zlib bzip2 gdbm;
  };

  python25 = python25Fun {
    db4 = if getConfig ["python" "db4Support"] false then db4 else null;
    sqlite = if getConfig ["python" "sqlite"] false then sqlite else null;
    readline = if getConfig ["python" "readlineSupport"] false then readline else null;
    openssl = if getConfig ["python" "opensslSupport"] false then openssl else null;
  } null;

That architecture is quite flexible because the user can configure the
'python25' package to her needs, and she can also define trivial variants of
that package to be used in dependencies, etc. It's fine to define dedicated
packages for headers and documentation, but I don't like the idea of forcing
users to install three packages just to get the contents of one.

Peter




More information about the nix-dev mailing list