> > Author: raskin
> > -{stdenv, fetchurl, perl, bison, mktemp, kernel}:
> > +{stdenv, fetchurl, perl, bison, mktemp, kernel
> > +  , version ? "1.5"
> > +  , sha256 ?  "1izhf8kscjymsvsvhcqw9awnmp94vwv70zdj09srg9bkpjj0n017"
> > +  , subdir ? ""
> > +}:
> 
> I don't think this is a good idea, unless there is a very good reason for 
> needing this kind of configurability.  Generally, the package function should 

Not really, just that any other way I thought of in 15 seconds will lead to
 incorrect version in the package name.

> know how to build a package - the call site should only pass in the 
> dependencies 
> and feature flags.
> 
> If really needed, it would be better to pass a "src" argument rather than 
> {version, sha256, subdir}.

But for correctness, I will have to also pass version. Maybe {version, src} 
would be better anyway, as the URL updates would be handled by mirrors.nix.

> > -    klibc = import ../os-specific/linux/klibc {
> > +    klibc = composedArgsAndFun (import ../os-specific/linux/klibc) {
> >        inherit fetchurl stdenv perl bison mktemp kernel;
> > -    };
> > +    } null;
> 
> What does "composedArgsAndFun" do?  (And it's almost certainly not a good 
> name 

It takes a function. Then it starts with empty attrSet for passing to the 
function,
and accepts any number of attrSet modifiers. Modifiers can be either attrSets 
for 
// operation or functions for application. After you have passed all the needed
modifiers, pass null to actually apply the function. The result of applying the
function will be modified by adding meta.function attribute. That function 
does exactly the same as would do the prepared function before null was passed.

> ;-)  Also, I really dislike all those weird nulls in all-packages.nix.

Hm. I will look at the current composedArgsAndFun usage pattern I have 
developed.
Maybe .meta.function fully replaces possibility to pass two argument modifiers
_______________________________________________
nix-dev mailing list
[email protected]
https://mail.cs.uu.nl/mailman/listinfo/nix-dev

Reply via email to