[Nix-dev] throw and mkOption default attribute when building options docs

Marc Weber marco-oweber at gmx.de
Sun Aug 17 10:57:55 CEST 2008


Hi @ll,

I've been hurt by the "you must specify the fileSystems option" or such
message which is passed to abort if the default setting [] is not
overridden by configuration.nix
Now I'd like to use [] because the root filesystem is mounted
automatically by the virtualizing software. So no need to do anything
(but adding a customStage1 script)..
My first attempt to fix it was allowing fileSystems = false.
However this leads to bypassing some maps etc which is ugly.

A much cleaner way would be allowing
mkOption {
  default = throw "you must set the xx option";
  example = { ... };
  description = "...";
};
Then you can use [], but you'll get still a fatal error if you rebuild
nixos and don't specify the setting.
But I fear that this makes documentation building fail as well, does it?

We could catch this kind of error and show in documentation
default: "no default value availible, this option must be set"

How do you like this?

Marc Weber



More information about the nix-dev mailing list