Bisecting the nixos channel

Currently I met with a problem, and cannot know its cause. What I know is there are two generations, one of which works, the other one of which doesn’t work. Because I know the commit hash of nixpkgs in my nixos channel of the two generations, I decides to bisect nixpkgs in nixos channel to see which commit introduced the bug. What I am currently doing is set the nixos channel to GitHub archive tar.gz links to pin a commit, but then the NixOS version will be shown as a pre-git instead of a detailed commit hash. I can still bisect as fine, but I just don’t know which generation is which when I look at the generation list. One possible way of working around this is to set system.configurationRevision in my configuration.nix, but since it is manually set, it will mislead me if I forgot to change the revision before a rebuilding. Any suggestions?

I would recommend cloning nixpkgs, using git bisect start <bad-commit> <good-commit> and nixos-rebuild switch -I nixpkgs=$PWD to build the system using the current nixpkgs checkout.

1 Like

Yeah but I think the version shown would still be a pre-git and doesn’t solve my problem.

Are you using flakes or channels or something else to manage your nixpkgs inputs?
And how are you checking the nixpkgs rev?

I am using channels if that’s not obvious. You mean normally how do I check the rev of a generation? The rev is the last section of NixOS version. You can see the full rev in nixos-version --json.

If your goal is to find the Nixpkgs revision that broke your system, what is the problem with running git bisect per Bisecting the nixos channel - #2 by rnhmjoj? When the bisect is finished you will have checked out the problematic commit; you can use git to look at it. There’s no need for nixos-version.

I am using git bisect except that I use only the git hash to modify the channel. I said “I can bisect as fine” in my original post. I just want to have a better view when I see the generation list.