GithubHelp home page GithubHelp logo

Comments (4)

getchoo avatar getchoo commented on August 26, 2024

the three most popular formatters are

alejandra

i'm personally a fan of alejandra and it's what i use in my nix stuff since it can make things look pretty good and it's aggressive enough with formatting so that the output is very consistent. it has some opinionated styling though, such as lists and attrs being formatted like this:

_: {
  list = [1 2  3 4];
  attr = {foo = bar;};
}

nixfmt

nixfmt is probably the most traditional one, but in my experience it doesn't really format much at all. i feel like this is good for personal projects since it helps you clean up your own unique style, but maybe not the best for collaborative project. a lot of it's formatting lets personal style bleed through and it's easily the most conservative of the three.

nixpkgs-fmt

nixpkgs-fmt is the closest we have to a "standard" formatter since it's in nix-community and has seen pretty wide adoption by projects inside and outside of that group -- and like alejandra, it formats a lot of stuff sometimes. it's style is similar to nixfmt, though with the exception of some small things such as arguments being formatted like this:

{ pkgs
, config
, lib
, ...
}:
{}

imo, nixpkgs-fmt or alejandra would be the best for this project since they create the most uniform code (plus they just look a bit better most of the time)

from nix.

Stonks3141 avatar Stonks3141 commented on August 26, 2024

I’m leaning toward nixpkgs-fmt just since it’s more standard in the community, so I’ll add it to CI. I’m still open to arguments for alejandra though.

from nix.

getchoo avatar getchoo commented on August 26, 2024

i like alejandra, but yeah i agree nixpkgs-fmt would be best for a collaborative project (plus it's just a formatter :p)

from nix.

Stonks3141 avatar Stonks3141 commented on August 26, 2024

Closed by #31

from nix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.