summary refs log tree commit diff
diff options
context:
space:
mode:
authorChuck <chuck@intelligence.org>2019-09-17 17:36:48 -0700
committerLinus Heckemann <git@sphalerite.org>2019-11-04 15:11:45 +0100
commit445145d5b9a33a9ded5a6928c52ddaeb862a8a8e (patch)
tree52a98b28d97e4eaaa72e1d0d7c29ddbbc39f907a
parenta3e31df4d779943cd462a36d63bb88cc4c3c66ed (diff)
downloadnixpkgs-445145d5b9a33a9ded5a6928c52ddaeb862a8a8e.tar
nixpkgs-445145d5b9a33a9ded5a6928c52ddaeb862a8a8e.tar.gz
nixpkgs-445145d5b9a33a9ded5a6928c52ddaeb862a8a8e.tar.bz2
nixpkgs-445145d5b9a33a9ded5a6928c52ddaeb862a8a8e.tar.lz
nixpkgs-445145d5b9a33a9ded5a6928c52ddaeb862a8a8e.tar.xz
nixpkgs-445145d5b9a33a9ded5a6928c52ddaeb862a8a8e.tar.zst
nixpkgs-445145d5b9a33a9ded5a6928c52ddaeb862a8a8e.zip
Support aggregate types attrsOf and listOf
-rw-r--r--nixos/modules/installer/tools/nixos-option/nixos-option.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/nixos/modules/installer/tools/nixos-option/nixos-option.cc b/nixos/modules/installer/tools/nixos-option/nixos-option.cc
index 778b7e32617..c0c9ec0e5b4 100644
--- a/nixos/modules/installer/tools/nixos-option/nixos-option.cc
+++ b/nixos/modules/installer/tools/nixos-option/nixos-option.cc
@@ -475,6 +475,11 @@ bool optionTypeIs(Context & ctx, Value & v, const std::string & soughtType)
     }
 }
 
+bool isAggregateOptionType(Context & ctx, Value & v)
+{
+    return optionTypeIs(ctx, v, "attrsOf") || optionTypeIs(ctx, v, "listOf") || optionTypeIs(ctx, v, "loaOf");
+}
+
 MakeError(OptionPathError, EvalError);
 
 Value getSubOptions(Context & ctx, Value & option)
@@ -507,7 +512,7 @@ Value findAlongOptionPath(Context & ctx, const std::string & path)
             if (isOption(ctx, v) && optionTypeIs(ctx, v, "submodule")) {
                 v = getSubOptions(ctx, v);
             }
-            if (isOption(ctx, v) && optionTypeIs(ctx, v, "loaOf") && !lastAttribute) {
+            if (isOption(ctx, v) && isAggregateOptionType(ctx, v) && !lastAttribute) {
                 v = getSubOptions(ctx, v);
                 // Note that we've consumed attr, but didn't actually use it.  This is the path component that's looked
                 // up in the list or attribute set that doesn't name an option -- the "root" in "users.users.root.name".