[Nix-dev] Displaying package parameters

Fabian Schmitthenner nix-dev at schmitthenner.eu
Mon Feb 29 04:59:58 CET 2016


Hi!

I just wanted to share that I tried displaying package parameters on the
nixos homepage and the current result can be seen here:
http://schmitthenner.eu/nixos-homepage/nixos/packages.html.

When you click on a package, you hopefully see its parameter. This uses
a heruristic to try to figure out which parameters are packages (and
thus not displayed) and which are not (and thus displayed) that goes
roughly as follows:

- If the parameter is instantiated - either implicitly or explicitly -
by callPackage, we look at the value and if it's a derivation, or a list
or attrset set of derivations, or a function it's not displayed
- Otherwise, it's displayed

I think there was a discussion about this a short while ago, but I
couldn't find it.

Please let me know what you think and if we might want a (more elaborate
version, e. g. also displaying the value of default arguments that
aren't changed by callPackage, which requires an other change to nix
because this info is currently not available, we only know if the
argument is optional or not afaik) of this on our official website.

Source code can be found on
https://github.com/NixOS/nixos-homepage/compare/master...fkz:master
Technically, I patched nixpkgs customization, so we not only get the
override... functions, but also the original parameters and the original
function.
Furthermore, this uses a patched version of nix which allows catching
errors inside nix (added a primop __catch) that also seems useful more
generally (when polished) (see https://github.com/fkz/nix/tree/catch-throw).

Fabian


More information about the nix-dev mailing list