enhanced error reporting missing config attr (new job proposal)
svn path=/nixos/trunk/; revision=11279
This commit is contained in:
parent
dc27e80fad
commit
0fbd66414a
@ -51,13 +51,13 @@ let
|
|||||||
else if pathExists p2 then import p2
|
else if pathExists p2 then import p2
|
||||||
else abort "service ${name} requested but there is no ${p}.nix or ${p}/default.nix file!";
|
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;
|
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
|
configV = name : if (__hasAttr name options ) then
|
||||||
let opt = (__getAttr name options ); # this config option description
|
let opt = (__getAttr name options ); # this config option description
|
||||||
in if (__hasAttr name thisConfig )
|
in if (__hasAttr name thisConfig )
|
||||||
then let v = (__getAttr name thisConfig); in if opt ? apply then opt.apply v else v
|
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 if opt ? default then opt.default else abort "you need to specify the configuration option ${errorWhere name}"
|
||||||
else abort "unkown option ${errorWhere}";
|
else abort "unkown option ${errorWhere name}";
|
||||||
checkConfig = (pkgs.lib.getAttr ["environment" "checkConfigurationOptions"]
|
checkConfig = (pkgs.lib.getAttr ["environment" "checkConfigurationOptions"]
|
||||||
optionDeclarations.environment.checkConfigurationOptions.default
|
optionDeclarations.environment.checkConfigurationOptions.default
|
||||||
config);
|
config);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user