about summary refs log blame commit diff
path: root/third_party/nix/tests/lang/eval-okay-dynamic-attrs.nix
blob: ee02ac7e657958d93ca2ddab63798fc860e55305 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                                
let
  aString = "a";

  bString = "b";
in {
  hasAttrs = { a.b = null; } ? "${aString}".b;

  selectAttrs = { a.b = true; }.a."${bString}";

  selectOrAttrs = { }."${aString}" or true;

  binds = { "${aString}"."${bString}c" = true; }.a.bc;

  recBinds = rec { "${bString}" = a; a = true; }.b;

  multiAttrs = { "${aString}" = true; "${bString}" = false; }.a;
}