[Nix-dev] NixOS: hardware based configuration.
Nicolas Pierron
nicolas.b.pierron at gmail.com
Fri Jul 25 20:07:22 CEST 2008
Hi list,
My concerns is about the following lines inside option.nix:
# Hm, this sounds like a catch-all...
hardware = {
};
I agree that the hardware section looks like a section which aggregate
everything.
At the moment there is only the attribute "enableGo7007" and I have
plan to add some other to support my laptop hardware in a clean way.
Some other attributes should figure in this section instead of being
spread over all configuration sections like:
networking = {
...
enableIntel2200BGFirmware = mkOption { ... };
enableIntel3945ABGFirmware = mkOption { ... };
...
};
As implied by the previous comment, the hardware attribute may contain
too much things. By the way this way of writing hardware devices does
not scale in Nix expression like following extract from
upstart-jobs/default.nix which is related to the udev job:
firmwareDirs =
pkgs.lib.optional
config.networking.enableIntel2200BGFirmware pkgs.ipw2200fw
++ pkgs.lib.optional
config.networking.enableIntel3945ABGFirmware pkgs.iwlwifi3945ucode
++ pkgs.lib.optional
config.networking.enableIntel4965AGNFirmware pkgs.iwlwifi4965ucode
++ pkgs.lib.optional
config.networking.enableZydasZD1211Firmware pkgs.zd1211fw
++ pkgs.lib.optional config.hardware.enableGo7007
"${kernelPackages.wis_go7007}/firmware"
++ config.services.udev.addFirmware;
In the previous lines I see one thing which is sound modular which is
the last line of the list concatenation. This line give the
opportunity to add extra firmware inside the configuration.nix file.
In the previous set of lines we are able to see that attributes
defined in the hardware/networking sections have some kind of
side-effects on the udev job configuration. One other point behind
this kind of configuration is that you may get confused between
hardware properties and configuration properties while you just want
edit/understand one point on the two.
To get rid of the previous point I suggest to separate the hardware
and the configuration. First I want to insist on that each device
need a specific configuration:
- udev firmwares
- kernel modules
- ...
So the idea is to have a nix-expression for each device that defines a
part of the computer configuration. This with a way of merging
configurations will give the opportunity to have a hardware based
configuration.
Therefore in the nixos repository will could add a new tree of directories like:
nixos/
| hardware/
| | network/
| | | generic.nix
| | | Intel2200BG.nix
| | | ...
| | video/
| | ...
| computer/
| | compaq/
| | | Presario2144EA.nix
...
In this example the nix expression Presario2144EA.nix will concatenate
all devices corresponding to this computer. This computer
configuration will be concatenated with the software configuration to
get a very quick and extremely specialized configuration.
One other advantage of such system is that simple expressions could be
added and shared easily. Another improvement no really related could
be to have a better hardware detection and hardware constraints to
have a stable system (e.g.: incompatible modules ...).
So if everybody accept this concept, The question coming after this
work would be to find a way to only added features required by the
hardware. At the end we should be able to quickly get a quick
workable OS even for new NixOS users :)
Stupid question: When you had other operating systems, how much time
have you spend at reading wikis, forum, etc ... just to get something
working? Don't you think it would be great to share the practical work
instead of comments?
Cheers,
--
Nicolas Pierron
- If you are doing something twice then you should try to do it once.
More information about the nix-dev
mailing list