Hi,

When handling optional deps, there's often a pattern similar to:

{..., depSupport ? false, dep ? null }:
assert depSupport -> dep != null ;
......
buildInputs = [...]
  ++ stdenv.lib.optional depSupport dep

I propose to add a standard function like this:

optionalInput =
  cond: elem: assert cond -> elem != null; if cond then [elem] else [];

This removes a good deal of asserts clutter and is easy enough to use so that 
maintainers will actually specify asserts as a byproduct instead of letting 
things fail at buildtime or silently not compile in the needed functionality.

-- 
Evgeny
_______________________________________________
nix-dev mailing list
nix-dev@cs.uu.nl
https://mail.cs.uu.nl/mailman/listinfo/nix-dev

Reply via email to