Attrset creation can refer to store path in the keys
#394
Opened by raitobezarius at
In Nix, referring to strings with contexts in the key of an attrset is forbidden and met with:
nix-repl> :l <nixpkgs> Added 20910 variables. nix-repl> { a = { "${pkgs.acl2}" = true; }; } { a = «error: the string '/nix/store/anp55r36pfkfklgymw2lcayckw5q7fq4-acl2-8.5' is not allowed to refer to a store path (such as '!out!6s6i3kk8xk4rypwnvb8hfxwkd723yif3-acl2-8.5.drv')»; }
With Tvix, we allow this sort of construction.
This is not a bug per se but out of excessive correctness, we should warn because we cannot serialize such attrsets, they contain hidden information (context) that we cannot always propagate.
I'd say add a check to attrset construction and also fail. This is an unrecoverable error in C++ Nix, so we'd accept expressions that are rejected by that implementation. Being able to retain context in there is also not that useful…
sterni at 2024-04-09T18·41+00