[Nix-dev] solution for do the right thing (even if you end up having the same package twice)

Marc Weber marco-oweber at gmx.de
Sat Mar 14 16:37:27 CET 2009


> to see wether there is any exception?
> You don't have to realise it. Wating till the .drv appears is enough.

perl support hasn't been enabled for subversion causing the assertion
failure causing git not showing up in nix-env -p ...

We've had this discussion multiple times.
But I think its time to discuss a solution that satisfies everyone.

I can think of

git = mkDerivation { ...
  buildInputs = optional subversionSupport (subversion.merge enablePerl);
  ..
}

  where enablePerl is using something like
  overridableDelayableArgs so that you can implement enablePerl in
  this way:
enablePerl = x :
  if x.perlSupport then x
  else trace "warning: enabling perl support in subversion for you automatically !"
             x // { perlSupport = true; };

Of course this enabling could be made optional.

For example we can introduce a new option in .nixpkgs/config.nix:

{
  enableDepsAutomatically = true; # false | warn ?
  # false: abort if you haven't enabled some flags on depending packages.
  # true: silently enable additional required flags (this can result in
  #        multiple store paths)
  # "warn":  same as true but also print a warning using builtins.trace
}

Of course using overridableDelayableArgs is only one (convinient) way to
implement this. In pracise this would lead to another function which
could be called requireDepFlag or such:

  buildInputs = optional subversionSupport (subversion.merge enablePerl);

would become

  buildInputs = optional subversionSupport (subversion.merge (requireDepFlag "perlSupport" true));

or such.

If you couldn't follow this mail let me know. I'll try to explain it in
more detail then.

Sincerly
Marc Weber



More information about the nix-dev mailing list