1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-26 07:31:20 +00:00
nixpkgs/nixos/modules/installer
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
..
cd-dvd nixos: doc: move non-service parts of service.nixosManual to documentation.nixos 2018-09-23 20:50:47 +00:00
netboot reewide: Purge all uses stdenv.system and top-level system 2018-08-30 17:20:32 -04:00
scan [bot] nixos/*: remove unused arguments in lambdas 2018-07-20 20:56:59 +00:00
tools nixos-option: don't abort with shell failures if options are not existant 2018-10-10 13:19:52 +02:00
virtualbox-demo.nix Revert "nixos: rename system.{stateVersion,defaultChannel} -> system.nixos.\1" 2018-07-28 00:12:55 +03:00