[Nix-dev] Re: [Nix-commits] SVN commit: nix - 16844 - raskin - in nixpkgs/trunk/pkgs: applications/misc/gphoto2 top-level

Eelco Dolstra e.dolstra at tudelft.nl
Tue Aug 25 11:34:54 CEST 2009


Hi,

Michael Raskin wrote:

> +  condPackage = condition: package: if condition then package else {};
> +  platformPackage = platforms : package : 
> +    (condPackage (lib.any (x: x == system) platforms) package) //
> +    { meta.platforms = platforms; };

It's not a good idea to have "platformPackage" in all-packages.nix.  It's a
property of a package, so it should be specified in the Nix expression of the
package, not in the composition (all-packages.nix).  Adding this kind of
information to all-packages.nix will just make it harder to get rid of (most of)
 all-packages.nix in the future.

Also, returning {} will cause unexpected behaviour if the package is used as a
dependency of another package (the latter will get an unexpected {} argument,
which may or may not cause evaluation to fail (I guess it does); "abort" or
assertion failures on the other hand are always propagated).

Why not use a meta attribute for this?  Maybe stdenv.mkDerivation could be
modified to look at the meta attribute and throw an abort error if the platform
doesn't match.

In fact, I see that you added a meta.platforms attribute.  What is the intended
semantics of that attribute?

- That the package is known to only work on the listed platforms? (E.g. packages
in os-specific/linux.)
- That the package is only supported on the listed platforms? (E.g. it might
work on others, but we don't know and there are no guarantees.)
- That the package should be built in Hydra on the listed platforms?

-- 
Eelco Dolstra | http://www.st.ewi.tudelft.nl/~dolstra/



More information about the nix-dev mailing list