[Nix-dev] NixOS: New scheme

Marc Weber marco-oweber at gmx.de
Mon Nov 17 23:54:03 CET 2008


On Mon, Nov 17, 2008 at 08:28:18PM +0100, Nicolas Pierron wrote:
> On Sun, Nov 16, 2008 at 23:19, Marc Weber <marco-oweber at gmx.de> wrote:
> >> At the end of the file, attributes are set like if this was your own
> >> computer configuration file.
> >>
> >> 2.2/ Options
> >>
> >> Options can have the following list of attribute:
> >>
> >> - default: Default value
> >> - example: Give an hint on the syntax accepted for this option.
> >> - description: Give context information about the option and its role
> >> in the configuration of the computer.
> >> - merge: Function which have two arguments (the name of the attribute,
> > name? Is this a full qualified one ? eg
> > services.network.apache.subversion.url or only "url" here ?
> 
> The full qualified name.
> 
> > Why do you pass it at all? Do be able to create nice error messages such
> > as "Wrong config option in <name>"?
> 
> exactly and also for the generated documentation.
> 
> > Maybe it's better to add a catch directive to the language then or
> > return some special attr set such as
> > { error = "foo"; } so that the library can create that error message
> > than?
> 
> catch method are use if you want to separate error handlers.  In my
> opinion, I would prefer to have something which retrieves the original
> location of an attribute definition instead of a name.
> 
> So error handlers would be like:
> 
> abort "${name}: ${builtins.locationOf value}: message."
Maybe we should also pass the error function then.. So you only have to
bother about
failure "message" which will call abort or something else and add the
location as well.. Why? I don't like code duplication and having a lot
of
abort "${name}: ${builtins.locationOf ..} .. " 
seems awkward to me.  Just think of changing it for whatever reason..
(Eg that it can be parsed easier by a gui or such)

Marc



More information about the nix-dev mailing list