NixOS / nix-pills

Creative Commons Attribution Share Alike 4.0 International
392 stars 117 forks source link

treewide: Format all Nix code according to RFC-166 #232

Closed dasJ closed 6 months ago

drupol commented 6 months ago

I see you pushed some changes, but is it still compliant with RFC-166 ?

henrik-ch commented 6 months ago

@dasJ, thank you for the comprehensive update to the repo's formatting—great work, especially given the scope! Apologies for chiming in a bit late on this.

To ensure consistency in future updates and avoid inadvertently diverging from the new standard, could you share the specific command or process you employed for this reformatting? I'm assuming there was some automation involved rather than manual adjustments?

I attempted to replicate the formatting on my end, targeting a pre-update version of the repo, using:

nix-shell -p nixpkgs-fmt --run 'nixpkgs-fmt .'

However, this only resulted in changes to a select few files within pill 20, as indicated by my git status output below:

❯ git status
HEAD detached at a66fd07
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
    modified:   default.nix
    modified:   pills/20/three-hellos.nix
    modified:   pills/20/two-hellos.nix
    modified:   release.nix

no changes added to commit (use "git add" and/or "git commit -a")

Please could you share the correct approach or any insights into the process you used.

Many thanks in advance! 🙏

dasJ commented 6 months ago

Unfortunately, the nix code is not actually in .nix files which meant manual work by calling the formatter manually rather than going over the entire tree :/

Also, the soon-to-be default formatter for nixpkgs will be nixfmt, not nixpkgs-fmt (I know the name is confusing). The new formatter is packaged in nixpkgs right now as nixfmt-rfc-style (not to be confused with nixfmt which has the "classic" pre-RFC style).

I know it's a mess right now but there is ongoing work to clean this up :)