nixpkgs/nixos/modules/installer/tools
Maximilian Bosch 76cc15a364
nixos-option: don't abort with shell failures if options are not existant
`nixos-option` basically handles two cases: the given option is either a
valid option defined using `mkOption` or an attribute set which contains
a set of options.

If none of the above cases is valid, `$1` is invalid. Unfortunatley the
script interpreted invalid options as an attribute set which rendered
shell failures when trying to evaluate the arguments.

First of all, `if names=$(attrNames ...)` resulted in `<PRIMOP>` as
`attrNames` simply evaluated `builtins.attrNames $result` which results
in a non-applied function with `$result` being empty. Trying to map over
this string using `nixMap` while applying `escapeQuotes` causes the bash
error as `eval echo "<PRIMOP>"` is invalid syntax.

Explicitly checking if `$result' contains a value (do we have an
attribute set?) and otherwise returning a warning and asking if $option
exists fixes the problem.

Fixes #48060
2018-10-10 13:19:52 +02:00
..
nixos-build-vms Remove some obsolete references to <nixos> 2015-08-05 17:37:08 +02:00
auto-upgrade.nix auto-upgrade: add proxy support 2017-08-30 01:25:47 +02:00
get-version-suffix Revert adding .git-revision unconditionally 2016-08-09 14:15:06 +02:00
nix-fallback-paths.nix nix: 2.1.2 -> 2.1.3 2018-10-02 11:07:48 +02:00
nixos-enter.sh nixos-enter: Ensures presence of full /sys tree. 2018-04-22 16:02:57 -04:00
nixos-generate-config.pl nixos-installer: use the hyperv module on hyperv 2018-09-28 22:28:18 +08:00
nixos-install.sh nixos-install: Create /root/.nix-defexpr 2018-02-27 20:21:23 +01:00
nixos-option.sh nixos-option: don't abort with shell failures if options are not existant 2018-10-10 13:19:52 +02:00
nixos-rebuild.sh build-vm: remove trailing dot from script path 2018-03-12 17:31:24 +09:00
nixos-version.sh nixos: rename config.system.nixos* -> config.system.nixos.* 2018-02-18 12:56:30 +00:00
tools.nix [bot] nixos/*: remove unused arguments in lambdas 2018-07-20 20:56:59 +00:00