mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-23 22:46:16 +02:00
f9913f4422
Now, in addition to a."${b}".c, you can write a.${b}.c (applicable wherever dynamic attributes are valid). Signed-off-by: Shea Levy <shea@shealevy.com>
17 lines
348 B
Nix
17 lines
348 B
Nix
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;
|
|
}
|