enhanced error reporting missing config attr (new job proposal)

svn path=/nixos/trunk/; revision=11279
This commit is contained in:
Marc Weber 2008-03-25 00:06:58 +00:00
parent dc27e80fad
commit 0fbd66414a

View file

@ -51,13 +51,13 @@ let
else if pathExists p2 then import p2
else abort "service ${name} requested but there is no ${p}.nix or ${p}/default.nix file!";
options = (jobFunc (args (abort "you can't use configV within options!"))).options;
errorWhere = "${name} of service ${builtins.toString path}";
errorWhere = name : "${name} of service ${builtins.toString path}";
configV = name : if (__hasAttr name options ) then
let opt = (__getAttr name options ); # this config option description
in if (__hasAttr name thisConfig )
then let v = (__getAttr name thisConfig); in if opt ? apply then opt.apply v else v
else if opt ? default then opt.default else abort "you need to specify the configuration option ${errorWhere}"
else abort "unkown option ${errorWhere}";
else if opt ? default then opt.default else abort "you need to specify the configuration option ${errorWhere name}"
else abort "unkown option ${errorWhere name}";
checkConfig = (pkgs.lib.getAttr ["environment" "checkConfigurationOptions"]
optionDeclarations.environment.checkConfigurationOptions.default
config);