The ‘printValueAsXML’ function in libexpr has an optional ‘location’ Boolean parameter, which determines whether to emit source location information or not. ‘nix-instantiate’ sets that to true, but the ‘toXML’ primop doesn’t do that. Perhaps it could expose an extra parameter for that? Ludo’.