1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-29 21:50:58 +01:00
nix/tests/functional/lang/eval-okay-dynamic-attrs-3.nix
Taeer Bar-Yam d56115eeb4
tests: add tests for dynamic attribute in let and inherit
Without a follow-up revert these tests will fail.

Co-authored-by: Sergei Zimmerman <sergei@zimmerman.foo>
Co-authored-by: piegames <git@piegames.de>

(cherry picked from commit 0c0a41a81a)
2025-11-26 00:29:27 +03:00

14 lines
262 B
Nix

# dynamic attrs are not generally allowed in `let`, and inherit, but they are if they only contain a string
let
${"a"} = 1;
attrs = rec {
b = c;
${"c"} = d;
d = a;
};
in
{
inherit ${"a"};
inherit attrs;
inherit (attrs) ${"b"} ${"c"} d;
}