Currently, when I need to tweak or try new things on nixpkgs, I git pull my local clone of nixpkgs, to keep up with the latest version, and then I start working.
This issue I have is that the nixpkgs repo is huge. It takes a lot of time just to git pull, every git operation is super slow, and it even makes my prompt lag, because in my prompt I query the “best” name I can find in the repo for the commit HEAD is currently at.
Are there any particular workarounds to handle such a massive repo? How do you work with it in your day to day life?
Personally, I just don’t have a fancy git-interactive prompt, and use git status when I really need to know the branch, or my editor’s built-in VC status, which also isn’t synchronous.
Reverting/logging/etc. is painfully slow, but thankfully I don’t need to do those often enough that it gets in the way of actual editing.
I’ve been picking at converting more of my own packages to flakes over the past few months and have one almost ready for lilgit. Not looking at my notes, but I think the main thing I wanted to fix is figuring out why the rust component stopped building against nixpkgs-unstable on darwin back in October.
Thanks for the tips, I really appreciate your help.
This sounds like exactly what I would need, but unfortunately I work with Bash (maybe this will be the time I switch to zhs). Anyways, I’ll keep the powerlevel10k solution in mind.
Most of the time, it’s ok for me too, because my editor’s git support isn’t synchronous either. The problem really arises when I’m just navigating in the repo in a terminal, and it’s painfully slow (it’s actually only about half a second / a second of delay each time to show the prompt, but it’s still really annoying).
It looks like lilgit does basically what my prompt does, except my prompt tries a little harder in finding a nice name to be shown (ie. it also takes into account tags), and, of course, the colors have been tailored to my needs. But since I basically pass all my time into a non-detached mode anyways, it’s not that useful to spend energy in trying to find a nice name where 90% of the time it’s just the name of the branch. So, if you ever finish packaging it, I’ll give it a try.
Some prompts like starship handle this kind of problem by setting a timeout for the prompt features. If you set an aggressive timeout, you won’t get nice git stuff in your prompt in nixpkgs, but at least it won’t be slow…
I optimistically worked on it a bit yesterday just in case. I got it converted it from crate2nix to crane, which seems to have fixed the need to pin its nixpkgs.
I haven’t finished updating the readme yet, but I did update it with:
Another issue with nixpkgs’ size is that you probably don’t want to use the flake CLI with the currently available versions of Nix when working on nixpkgs. It always copies to the store. And even though it was only a few gigabytes worth after a fairly large amount of iterations for me personally (thanks, ZFS compression), it was still made up of lots and lots of random tiny files, which is the most hostile scenario for basically any file system, and it literally took an hour for nix-collect-garbage to get rid of it all. Future versions of Nix will eventually have a fix for this, but it has annoyed me.
And at least the first two lines made it way faster; like, near instant for most things. I don’t remember if the other two helped the speed or if that was just preference.
Thanks for the magit configuration. It works fine with some quirks… For example, in the magit status buffer, if the curser is at the top (at Head, Merge, or Push), typing SPC b x to delete a branch takes about 4 seconds. However, if I move the cursor below, the branch selection popup appears instantaneously. Do you observe the same behavior and have any ideas as to why this could be the case?