nixfmt puts quotes in the wrong place and breaks this file
Closed this issue · 4 comments
Ramblurr commented
nixfmt --version
nixfmt v0.6.0
Reproduce:
# fetch file
curl https://gist.github.com/Ramblurr/0463c3ba20948ce7b84203c699264a59/raw/8552947240dbd2d927eb16b6d9a6550692368867/dynamic-wallpaper.nix --output dynamic-wallpaper.nix
# format once
nixfmt dynamic-wallpaper.nix
# format again
nixfmt dynamic-wallpaper.nix
Result:
dynamic-wallpaper.nix:130:13:
|
130 | hour="$(date +%k | xargs)" # xargs removes leading whitespace
| ^
unexpected '='
expecting expression
..and the file is broken.
piegamesde commented
Unfortunately I cannot reproduce. Could you please try minimizing your example, and also make sure you are using the latest master branch?
Ramblurr commented
I switched from the unstable nixpkgs nixfmt
to the one provided by the flake in this repo, and I can also no longer reproduce.
dasJ commented
If you want the nixfmt from nixpkgs unstable, you can use nixfmt-rfc-style
which is the new style :)
Ramblurr commented
Ah is there a difference?
Which repo should I report this bug to then because the unstable nixfmt is definitely breaking that file.
Edit:
Oh not pkgs.nixfmt
but pkgs.nixfmt-rfc-style
. I'll try that one and report back.