oxalica / nil

NIx Language server, an incremental analysis assistant for writing in Nix.
Apache License 2.0
1.28k stars 39 forks source link

nil vs nixd #111

Open srghma opened 10 months ago

srghma commented 10 months ago

hi, i'm new here

they both provide language server for nix

  1. what is the difference?
  2. which should I use?
  3. I see nil can be used as pre-commit-hook using https://github.com/cachix/pre-commit-hooks.nix (to do....what?), but nixd - can?

TODO: add this info into readme?

TLATER commented 9 months ago
  1. nixd actually evaluates the code, which makes it very flexible for a wide variety of projects you can do with nix, but makes it pretty configuration heavy, since you need to teach it how to evaluate your project.

    nil on the other hand is very configuration-light, working perfectly out of the box most of the time, but when your project uses e.g. home-manger won't give you any option completion for that.

  2. Both projects are independently useful, I usually use nil because I can't be bothered to configure nixd for every little project, but I can imagine myself configuring nixd for a specific project at some point in the future to get more specific diagnostics.

  3. https://github.com/oxalica/nil/blob/main/docs/features.md#cli-features nixd doesn't support anything like this, it's purely a language server, but you can get the same result with a clever nix eval so you don't really need explicit support for it from nixd.

I'm not sure this should be added to the readme, most of this info is pretty easy to get if you just read both projects' readmes with a bit of background knowledge, or just try them out. Pretty standard for evaluating tools really.

It's also not really nil's job to document nixd, and any such documentation will just drift as nixd changes, without being able to be reflected in nil's readme without making commits just to update the readme (which really is just an unnecessary maintenance burden for nil).