Bisecting: Difference between revisions
Appearance
add note on hydrasect being broken |
correct --flake as applying specifically to nixos-rebuild |
||
| Line 20: | Line 20: | ||
* <code>--override-input</code>: nix flag that enables bisecting flakes' inputs | * <code>--override-input</code>: nix flag that enables bisecting flakes' inputs | ||
* <code>--flake</code> flag on | * <code>--flake</code> flag on [[nixos-rebuild]]: allows overriding flake directory so you can use nix flake operations from e.g. <code>git bisect run</code> | ||
[[Category:Version control]] | [[Category:Version control]] | ||
Revision as of 13:34, 10 January 2025
Bisecting is a feature of version control systems such as Git and Mercurial to easily pinpoint regressions. Owing to their reproducibility, Nix and NixOS are well-suited to this. As a result, we will list a few tips for using tools like this in the Nix context.
Commit selection
There are different ways to tweak git bisect's commit selection to reduce the required builds:
git bisect startflag--first-parent: select merge commits, which depending on the repository can help for caching as well as commit stability.- brokenhydrasect: select cached commits cached by Hydranixpkgs-staging-bisecter(nix-buildonly): reduce number of derivations to be built.
Automating bisects
git bisect run: runs the selected command until the culprit is found.nix-bisect: helps better judge outcome (git bisect'sgoodvsbadskip) and gives nicer outputs thangit bisect run.
Flakes
Bisecting changes in a flake itself can just follow the regular bisecting process. Bisecting regressions in flakes' inputs is a bit different in the sense the repositories you are building is not the repository you are bisecting. In this case you can use:
--override-input: nix flag that enables bisecting flakes' inputs--flakeflag on nixos-rebuild: allows overriding flake directory so you can use nix flake operations from e.g.git bisect run