nixpkgs-fmt icon indicating copy to clipboard operation
nixpkgs-fmt copied to clipboard

error: The argument '--explain' cannot be used with 'srcs'

Open davidak opened this issue 4 years ago • 3 comments

Describe the bug What does this error mean? What is srcs? sources?

[davidak@gaming:~/code/nixpkgs]$ nixpkgs-fmt --explain pkgs/os-specific/linux/kbd/default.nix
error: The argument '--explain' cannot be used with 'srcs'

USAGE:
    nixpkgs-fmt --explain

For more information try --help

Since the help is not enough here, it would be nice to have examples how to use the tool.

System information

nixpkgs-fmt 1.2.0

davidak avatar Apr 13 '21 05:04 davidak

It seems like you can do something like:

nixpkgs-format --explain < file

but the output is pretty ugly, and I don't exactly understand how it's supposed to work.

sumnerevans avatar Apr 30 '21 17:04 sumnerevans

It could probably work as long as there is only a single file passed to it.

zimbatm avatar Apr 30 '21 20:04 zimbatm

I have a tree of nix files where running nixpkgs-fmt complains about 1/21 need being reformatted.

When I find . -type f -name \*.nix -exec bash -c "nixpkgs-fmt --explain < {}" \; I just get all files contents printed, i. e. nixpkgs-fmt seems to apply formatting regardless. There is no output telling me which rules are violated or none.

Also find . -type f -name \*.nix -exec bash -c "nixpkgs-fmt --check < {}" \; afterwards finds no errors anymore.

573 avatar Aug 10 '22 06:08 573