Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nixfmt does overwrite symlinks with reformatted contents #56

Closed
NobbZ opened this issue Feb 12, 2020 · 5 comments
Closed

Nixfmt does overwrite symlinks with reformatted contents #56

NobbZ opened this issue Feb 12, 2020 · 5 comments
Labels
bug Something isn't working

Comments

@NobbZ
Copy link

NobbZ commented Feb 12, 2020

When I have a symlink and pass it to nixfmt (eg because of using globbing from the shell as in nixfmt **/*.nix) it gets overwritten by a regular file containing the formatted target.

nixfmt should either ignore symlinks or write to the symlinks target, rather than overwriting the symlink.

$ readlink -f default.nix
/home/nmelzer/.config/nixpkgs/hosts/vbox-arch.nix
$ nixfmt default.nix
$ readlink -f default.nix
/home/nmelzer/.config/nixpkgs/hosts/default.nix
$ nixfmt --version
Format Nix source code

Sadly it seems as if in my version of nixfmt #50 isn't fixed yet.

@Lucus16
Copy link
Contributor

Lucus16 commented Feb 14, 2020

Thanks for reporting! I made a PR with a fix that should be merged soon. Unfortunately, our releases go through hackage and that can be kind of slow. If you don't want to wait for those, the README contains instruction for installing nixfmt from master.

@NobbZ
Copy link
Author

NobbZ commented Feb 14, 2020

As far as I see, the version fix should already be available in latest release, at least according to the GitHub interface, though it doesn't seem to be in nixpkgs yet.

Though I might consider an installation from source, as in general the process behind updating something in nixpkgs seems to be quite slow.

@yorickvP yorickvP added the bug Something isn't working label Feb 25, 2022
@felixscheinost
Copy link

Is there still someone working on this?

@infinisil
Copy link
Member

See #151

@infinisil infinisil closed this as not planned Won't fix, can't repro, duplicate, stale Aug 6, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in Nix formatting Aug 6, 2024
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/formatting-team-meeting-2024-08-06/50222/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

6 participants