Can i git bisect a flake?

I’ve used things like , to bisect problems encounted with nixpkgs to track down bugs and SQUASH them. (or a least collect them in a jar, and release them back into the wild).

Is it possible to bisect a flake in this way?

if so, how would i go about it.

1 Like


nix-bisect does not really support Flakes but as long as the flake in question uses flake-compat for all the relevant git commits, nix-build-status should still work as usual.

If you need to bisect against a different repo than the Nix derivation is in, it gets more complicated since nix-build-status does not support the flake CLI flags.

In that case, you will need to either:

  1. use a plain nix build
    For example, I recently bisected Node.js repo to diagnose a build failure in a JS project. I applied the following patch to Nixpkgs:

    --- a/pkgs/development/web/nodejs/v18.nix
    +++ b/pkgs/development/web/nodejs/v18.nix
    @@ -5,11 +5,11 @@ let
         python = python3;
    -buildNodejs {
    +(buildNodejs {
       inherit enableNpm;
       version = "18.6.0";
       sha256 = "0k05phvlpwf467sbaxcvdzr4ncclm9fpldml8fbfrjigl4rhr2sz";
       patches = [
    +}).overrideAttrs (attrs: { src = /home/jtojnar/Projects/node; })

    And then run the following command in the Node.js checkout:

    git bisect run nix build ~/Projects/nixfiles#pengu -L --keep-failed --impure --override-input nixpkgs ~/Projects/nixpkgs

  2. Create a custom build expression file utilizing flake-compat and run nix-build-status with -f flag pointing to the file.

1 Like