[Nix-dev] Re: New proposal about expression syntax usage.

Michael Raskin 7c6f434c at mail.ru
Wed Aug 15 14:56:07 CEST 2007


apfelmus wrote:
> Michael Raskin schrieb:
>> But it doesn't check that all of them are used anyway. So when you are
>> editing a package it is easy to forget to add something to buildInputs
>> etc. And not being able to pass extra arguments is not such a big plus
>> per se.
> 
> Yes, lazy evaluation exactly means that there is no check whether the
> packages are actually used or not. But the pattern match does check
I would say that it is more about not evaluating unused parts than about
 possibility to mark that a function must somehow use all of its
arguments (without prohibiting to pass them to argument-ignoring functions).

> whether the arguments are supplied at least (does it?), i.e. it's the
> compiler complains if you forgot to pass an argument to the function.
I have already corrected the template, so that any non-mentioned
argument does not get to be used in buildInputs. Missed dependencies
also abort at the pure Nix-evaluation stage.


> It's also conceivable to have separate argument for packages and flags,
> i.e. something like
> 
>   foo = args@{stdenv, packages@{fetchurl, ncurses}, flags@{useBar}} : {
>    ...
>     buildInputs = toList packages;
>   }
> 
>   foo {inherit stdenv; {inherit fetchurl, ncurses;}; { useBar = true };}
Maybe yes. Another question, if it is worth little added writing.

> In fact, that could even be used to eliminate the duplication in
> all-packages.nix by recursively supplying the whole package set as
> argument, like in
> 
>   foo {inherit stdenv; all-packages; { useBar = true }; }
>
> That now assumes that there is no check whether too many arguments have
> been passed. In fact, this is a bit dangerous since the pattern match
> for {fetchurl, ncurses} now has to filter the attribute set or the
> buildInputs  will be _all_ packages from  all-packages !
I understood (and it seemed that Eelco (Dolstra) agreed) that writing
explicitly dependencies in all-packages.nix was deliberate. It allows
not multiplying flags in simple cases; it gives more control (you have
one file that allows you to check if package A depends on package B).



More information about the nix-dev mailing list