Keeping up with nixos unstable

Both of my dev machines are running nixpkgs/nixos unstable. I prefer to keep everything up to date, and incrementally change stuff that breaks.

The problem:
Whenever I update nixpkgs to HEAD, it results in a massive download of build deps & a long rebuild from scratch. I don’t really need the newest commit, just a new enough commit that’s already been built and cached.

My lousy solution:
In order to mitigate this, I often go to Commits · NixOS/nixpkgs · GitHub, paginate a few pages until I see some green checkmarks and grab that commit.
This usually resolves the issue and I hit most of the cache.

I’m assuming this could be done in a better way - what’s everyone else doing to resolve this problem?

Wait you’re saying that you end up building derivations that should be cached? That makes it sound like you’re using master, not unstable. Unstable doesn’t advance to a new revision until everything is cached that successfully builds.

2 Likes

You might be right, I was assuming those two were the same.

inputs = {
  nixpkgs.url = "github:nixos/nixpkgs";
}

So to mark this as a solution: changing

  nixpkgs.url = "github:nixos/nixpkgs";

to

    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";

should result in exactly what I described above?

Yea, that’s master, not unstable. You need to use github:NixOS/nixpkgs/nixos-unstable as the url.

PRs aren’t built and cached before they’re merged. Hydra just pulls the latest master every day or two, builds and caches everything in it, and finally updates nixos-unstable to point to that revision.

4 Likes

Thank you @ElvishJerricco , appreciate the super fast answer!