[Nix-dev] NixOS: what will change if you modify an option.

Nicolas Pierron nicolas.b.pierron at gmail.com
Mon Sep 28 11:27:55 CEST 2009


Hi Nixers,

One of the difficult things to find out is what would be change if I
set an option.  The good news is that I found a way to retrieve this
information.  The bad news is that a lot of terms are created and used
only once to test and are causing a huge memory consumption.

What I've made a nix expression capable of finding which options
are directly affected by your changes.  If an option A is changed
after setting the option B, this means that the option B (in)directly
use the option A.  So this link is not very helpful because it may
skip a lot of options in the process.  So I've changed the evaluation
process and feed it (via the config argument) with its primary result
except that one result is altered,  Then I compare the result of the
primary evaluation with the altered evaluation to determine which
option is affected.  After running it on some options I was able to
obtain the following graph:

http://nbp.name/nixos/option_usages.pdf

In this case "hardware.pcmcia.firmware" does not appear because
"hardware.pcmcia.enable" is false on my computer.  So changing
"hardware.pcmcia.firmware" does not change any value inside the system
because there is a "mkIf hardware.pcmcia.enable" on top of the
expression.  If I enable it, then the "firmware" attribute should
appear in this graph.  The current representation is helpful when
options are used in multiple modules (which is not the case of
"hardware.pcmcia.enable"), but the opposite graph would be much more
valuable to find out which attributes are causing a problem.

Unfortunately, generating this small graph takes up to 1GB of memory.
We need to find out a way to remove unused cached terms before the
segmentation fault probably caused by the resizing of the ATerm's
hashtable.

-- 
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron
Donald Knuth - I can't go to a restaurant because I keep looking at
the fonts on the menu.



More information about the nix-dev mailing list