TomB  
                
                  
                    November 25, 2024,  7:48pm
                   
                  1 
               
             
            
              I set my editor up to run nixfmt (with the nixfmt-rfc-style package) on save for .nix files which has worked nicely for my own config files.
But now I wanted to make a change to nixpkgs and both nixfmt-classic and nixfmt-rfc-style are causing large diffs due to the formatting changes.
Which formatter does nixpkgs uses? Is there one I can use for this project?
             
            
              1 Like 
            
           
          
            
            
              Nixpkgs will use nixfmt-rfc-style, the official formatter (repo ). This is already enforced  for new and already-formatted files, and a treewide reformat is planned, see Treewide Nix reformat pass 1 [skip treewide] by infinisil · Pull Request #322537 · NixOS/nixpkgs · GitHub  and its links.
We don’t have a lot of resources, so things are moving slow, but we only have like a single blocking issue before we can move forward with the full Nixpkgs reformat. See Formatting Team Meeting 2024-10-01 , Don't expand final list arguments of functions by infinisil · Pull Request #254 · NixOS/nixfmt · GitHub  and Better list argument handling by piegamesde · Pull Request #257 · NixOS/nixfmt · GitHub . We could use more help with this!
The formatting team  is scheduled to have the bi-weekly meeting again tomorrow at 2024-11-26T19:00:00Z  where we should discuss how to move forward. Anybody is free to join the meeting , there’s also a Matrix room  
             
            
              4 Likes 
            
           
          
            
            
              Just realising that I didn’t really answer the full original question 
Traditionally it didn’t use any formatter, so files introduced before the enforcement of nixfmt-rfc-style are not consistently formatted.
Because we’re in this transition period, it’s not possible to use a formatter globally for now.
             
            
              2 Likes