mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-28 06:14:26 +03:00
nixos-option: Produce nicer error messages in case of typos.
This commit is contained in:
parent
640428d3c5
commit
c9682a22ff
@ -94,7 +94,7 @@ in with nixpkgs.lib;
|
|||||||
# the user into accessors for reaching the definition and the declaration
|
# the user into accessors for reaching the definition and the declaration
|
||||||
# corresponding to this option.
|
# corresponding to this option.
|
||||||
generateAccessors(){
|
generateAccessors(){
|
||||||
evalNix --strict --show-trace <<EOF
|
if result=$(evalNix --strict --show-trace <<EOF
|
||||||
$header
|
$header
|
||||||
|
|
||||||
let
|
let
|
||||||
@ -129,6 +129,17 @@ let
|
|||||||
in
|
in
|
||||||
''let option = \${walkResult.opt}; config = \${walkResult.cfg}; in''
|
''let option = \${walkResult.opt}; config = \${walkResult.cfg}; in''
|
||||||
EOF
|
EOF
|
||||||
|
)
|
||||||
|
then
|
||||||
|
echo $result
|
||||||
|
else
|
||||||
|
# In case of error we want to ignore the error message roduced by the
|
||||||
|
# script above, as it is iterating over each attribute, which does not
|
||||||
|
# produce a nice error message. The following code is a fallback
|
||||||
|
# solution which is cause a nicer error message in the next
|
||||||
|
# evaluation.
|
||||||
|
echo "\"let option = nixos.options${option:+.$option}; config = nixos.config${option:+.$option}; in\""
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
header="$header
|
header="$header
|
||||||
|
Loading…
Reference in New Issue
Block a user