Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Nix is slow enough that having it in your pre-commit gets annoying


Putting aside that blanket statement, that just makes no sense whatsoever. You use Nix to generate pre-commit configuration. That configuration contains unique paths to linters. Those paths will always point to an identical build of a Nix package, ensuring consistency. There's no room for Nix to slow down the pre-commit hook, because it doesn't run during the execution of the hook at all.


When combined with direnv, the nix portion is almost entirely cached, so there's nothing to make it slow. I use pre-commit hooks via devShell in many projects, and they're nearly instant. The only exception is when the hook itself is slow.


Haven't run into that yet, but can imagine that it gets worse if your devenv is large.

I'm sure it's something that can be engineered away and optimized in the Nix core though. Because yeah it isn't a hyperspecialized tool for specifically git hooks alone written in Rust. No.

It's not a saw nor a hammer. It's an entire workshop.

Flakes are less of a workshop, but more like a bus with tools or a heavy-duty toolbox.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: