Minimal set of NixOS modules

#1

Hi,

during last NixCon in London someone (Eelco?) came up with a minimal set of NixOS modules for a working base system. The context of that discussion was how to minimize evaluation time by excluding unnecessary modules.

Does anyone know where to find this list?

TIA

#2

I just stumbled upon [RFC 0022] Minimal module list which links to a “minimal” module list:

The “minimal” configuration replaces module-list.nix with a smaller list. (This list can be reduced a bit further by eliminating some unnecessary module dependencies, e.g. hardware/opengl.nix and services/networking/dnsmasq.nix are unnecessary. On the other hand, some modules that are not needed to evaluate the configuration but that are needed to get a workable system are probably missing.)

I assume this is what you’re looking for.

1 Like
#3

Yes, exactly. Thank you :slight_smile:

#4

Just a quick follow-up over here. We’ve been investigating making our hydra faster and apart from the issue that we’ve seen our old 15.09 evaluations take substantially longer in the hydra evaluator we tried the reduced module list (i stripped the 15.09 list down to 190 from almost 500 modules) but the effect was negligible. Here’s an instantiation with the full list based on our hydra release expression (using busybox/time):

   Command being timed: "nix-instantiate -K -I nixpkgs=. nixos/release-flyingcircus.nix"
   User time (seconds): 261.63
   System time (seconds): 5.46
   Percent of CPU this job got: 171%
   Elapsed (wall clock) time (h:mm:ss or m:ss): 2m 35.37s
   Average shared text size (kbytes): 0
   Average unshared data size (kbytes): 0
   Average stack size (kbytes): 0
   Average total size (kbytes): 0
   Maximum resident set size (kbytes): 8284416
   Average resident set size (kbytes): 0
   Major (requiring I/O) page faults: 1
   Minor (reclaiming a frame) page faults: 518995
   Voluntary context switches: 649396
   Involuntary context switches: 3127
   Swaps: 0
   File system inputs: 222448
   File system outputs: 0
   Socket messages sent: 0
   Socket messages received: 0
   Signals delivered: 0
   Page size (bytes): 4096
   Exit status: 0

And here’s the output with the reduced module list:

	Command being timed: "nix-instantiate -K -I nixpkgs=. nixos/release-flyingcircus.nix"
	User time (seconds): 252.26
	System time (seconds): 4.51
	Percent of CPU this job got: 182%
	Elapsed (wall clock) time (h:mm:ss or m:ss): 2m 20.48s
	Average shared text size (kbytes): 0
	Average unshared data size (kbytes): 0
	Average stack size (kbytes): 0
	Average total size (kbytes): 0
	Maximum resident set size (kbytes): 6860016
	Average resident set size (kbytes): 0
	Major (requiring I/O) page faults: 0
	Minor (reclaiming a frame) page faults: 428040
	Voluntary context switches: 622183
	Involuntary context switches: 2339
	Swaps: 0
	File system inputs: 0
	File system outputs: 0
	Socket messages sent: 0
	Socket messages received: 0
	Signals delivered: 0
	Page size (bytes): 4096
	Exit status: 0

The memory usage went down noticably but that isn’t too much of a concern for us at the moment. On the machines that actually build their system configurations we’ve only seen a reduction from 12 seconds overall time (basically nixos-rebuild switch during a noop evaluation) to 10s and a reduction of memory usage from 2.2g to 2.07g …

So, I’m not sure how @edolstra managed to get a more significant reduction, but his set in RFC 22 was much larger with 50 machines. I guess this means the effect is non-linear and the sizing of a 50/200/500/800 entry module list is such that 800 has become prohibitive whereas 200/500 sit in a kind of middle ground …

At the moment we’re going to try to throw a bit more hardware at it by switching CPUs from an old Xeon X5650 @ 2.67GHz to a newer high clocked E3-1270 v6. We’ll likely keep the old machine due to the high number of cores it offers.

1 Like
#5

Interesting, thanks for sharing your results :slight_smile:

The following nixpkgs issue might also be interesting regarding the evaluation times:

#6

Oh in my last comment on that issue I’ve actually also generated a minimal module list (click on the “> details” link there)