jfly
February 17, 2026, 7:47pm
1
4 Likes
toastal
February 21, 2026, 2:51pm
2
@jfly we any closer to proper tab support with magic strings?
1 Like
jfly
February 24, 2026, 7:36pm
3
@toastal , sorry, what are magic strings?
toastal
February 25, 2026, 5:36am
4
opened 02:22PM - 14 Feb 23 UTC
bug
language
breaking
**Describe the bug**
Tabs are not supported in the indentation stripping pars… er. This is the right behavior in principle, but when a user does insert a tab, the behavior does not match their indentation. The right solution is to warn and let the user fix the problem. Supporting tabs is wrong, because tab width is undefined and will never be defined consistently.
Adding a warning may make `'' ''` strings annoying for users who have to write strings with tabs at the start of lines, but their solution is already fragile, so they should move to explicit tabs (`"\t"`) or put the string in a separate file.
**Steps To Reproduce**
1. Write a file with a `''` string indented with tabs or a mix of spaces and tabs.
2. Parsed string contains tab characters.
**Expected behavior**
Warn when the first tab is encountered in the indentation stripping logic. Suggest alternatives, for both cases: user wants tabs stripped, or (less likely, current behavior) user wants to keep tabs in their string.
**`nix-env --version` output**
**Additional context**
Removing tabs from indented strings is a hash-changing breaking change. (edit: 2024-10)
- see also https://github.com/NixOS/nix/pull/9971#issuecomment-1986903150
**Priorities**
Add :+1: to [issues you find important](https://github.com/NixOS/nix/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc).
The ones that allow you to indent ''''. It would be a big win for accessibility—which affects formatting.
1 Like
Fully agree that this issue needs to be discussed again after such a period of silence. The main thing is - it does not break anything for anybody. People who formatted with spaces are unaffected at all. Who use tabs are likely strip them with a function. Only like a very minority would need to rebuild those derivations - which doesn’t seem like a compatibility issue. And I personally suffer a bit with the fact that there is no tab support in nix strings and formatter. Thanks for listening!
1 Like
jfly
February 27, 2026, 6:56pm
6
Sorry, help me understand how much of this is a nix interpreter issue vs a nixfmt issue.