[Nix-dev] Make Firefox/Chrome use OpenJDK instead of Oracle JDK?

Chad Joan chadjoan at gmail.com
Mon Feb 23 07:02:30 CET 2015


I see.  Thank you for being up-front about it.

That link is helpful; I've been reading a thing or two in all-packages.nix
as needed, but I didn't realize these options would be defined there.

This really reminds me of Gentoo USE flags.  I can't blame anyone for not
wanting to go around meticulously and manually writing documentation for
every configuration option.  It would be better if the structure of the
option definitions allowed an automated tool (or perhaps a nix expression)
to walk the package definitions and generate the documentation.  This would
at least give you name:exists/doesn't-exist information for each option
without any extra per-package work.  Gentoo has the IUSE variable in its
.ebuild files to define on/off configuration options for packages, though I
suspect Nix's approach might be slightly different.

In the case of wrapFirefox, automated documentation would be hindered by
the fact that the wrapFirefox definition is looking for symbols that
someone else may or may not have defined.  To make our lives easier,
though, the symbols could *always* be defined (globally) and be equal to
your default values unless the user/admin/person overrides it in
configuration.nix.  Stick these all in one conventional place and have a
nix expression scan it to generate a document of all packages and their
configuration options.  Someone maintaining the package definition would
write "config.defineOptOrWhatever firefox icedtea false;" somewhere instead
of writing "jre = cfg.jre or false;" in wrapFirefox.  Then, this
documentation would come up whenever someone runs 'nix-env -qa
<package-name>'.

I'm afraid my comprehension of nix-expressions is still a bit weak, so I
can't be more specific.  I'm not quite sure how I'd do something vaguely
stateful like registering a bunch of configuration options in a central
list, then overriding them, and then consuming them later.  I've already
seen a bunch of option-defining and overriding in Nix already, though, so
this process seems practical, and may even be quite simple for someone with
the know-how.  The tedious part would be changing the idioms of existing
packages.

Sorry for the wall of text.  I hope this is helpful.
- Chad


On Sun, Feb 22, 2015 at 7:38 PM, Vladimír Čunát <vcunat at gmail.com> wrote:

> On 02/22/2015 07:59 AM, Chad Joan wrote:
>
>> Is there a way for me to discover other useful configuration options
>> like this?
>>
>
> AFAIK the only complete way is just to read the source expressions of what
> you're interested in, e.g. in this case:
> https://github.com/NixOS/nixpkgs/blob/c2c561ad4d4/pkgs/
> top-level/all-packages.nix#L11824
>
> Unfortunately docs are rather sparse on such detailed topics, as not so
> many contributors are involved.
>
> Vladimir
>
>
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20150223/9eceaa73/attachment-0001.html 


More information about the nix-dev mailing list