Skip to content

nixfmt converts symbolic links to a copy #312

@badcold

Description

@badcold

I've tried to reformat my machine's configuration.nix, which was a symbolic link and it made a copy of the file at the link's location.

[badcold@i7-3770k:~/demo]$ nixfmt --version
nixfmt nixpkgs-unstable-2025-04-04

[badcold@i7-3770k:~/demo]$ ls -la
total 16
drwxr-xr-x  4 badcold users 4096 Jun  9 11:11 .
drwx------ 72 badcold users 4096 Jun  9 11:10 ..
drwxr-xr-x  7 badcold users 4096 Jun  9 11:11 .git
drwxr-xr-x  2 badcold users 4096 Jun  9 11:10 elsewhere
lrwxrwxrwx  1 badcold users   18 Jun  9 11:11 test.nix -> elsewhere/test.nix

[badcold@i7-3770k:~/demo]$ nixfmt test.nix

[badcold@i7-3770k:~/demo]$ ls -la
total 20
drwxr-xr-x  4 badcold users 4096 Jun  9 11:12 .
drwx------ 72 badcold users 4096 Jun  9 11:10 ..
drwxr-xr-x  7 badcold users 4096 Jun  9 11:11 .git
drwxr-xr-x  2 badcold users 4096 Jun  9 11:10 elsewhere
-rw-r--r--  1 badcold users  120 Jun  9 11:12 test.nix

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions