Import but don’t import your NixOS modules

The import keyword simply takes the contents of another file and drops it in-place where you import-ed, which is why using import messes up location info.
Using your example, if you set something like _file = ./greet.nix; in your greet.nix you would get the correct location information.
It’s not a pattern I’d recommend often, but it’s good to know about, especially as location information is also used in error messages.

3 Likes