Bisecting: Difference between revisions
better factor bisecting tips |
add note on hydrasect being broken |
||
Line 6: | Line 6: | ||
* <code>git bisect start</code> flag [https://git-scm.com/docs/git-bisect#Documentation/git-bisect.txt---first-parent <code>--first-parent</code>]: select merge commits, which depending on the repository can help for caching as well as commit stability. | * <code>git bisect start</code> flag [https://git-scm.com/docs/git-bisect#Documentation/git-bisect.txt---first-parent <code>--first-parent</code>]: select merge commits, which depending on the repository can help for caching as well as commit stability. | ||
* [https://git.qyliss.net/hydrasect/about/ <code>hydrasect</code>]: select cached commits cached by Hydra | * <s>[https://git.qyliss.net/hydrasect/about/ <code>hydrasect</code>]: select cached commits cached by Hydra</s> - [https://github.com/NixOS/nixpkgs/issues/323985#issuecomment-2210893775 broken] | ||
* [https://github.com/symphorien/nixpkgs-staging-bisecter <code>nixpkgs-staging-bisecter</code>] (<code>nix-build</code> only): reduce number of derivations to be built. | * [https://github.com/symphorien/nixpkgs-staging-bisecter <code>nixpkgs-staging-bisecter</code>] (<code>nix-build</code> only): reduce number of derivations to be built. | ||
Latest revision as of 19:20, 5 July 2024
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 start
flag--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-build
only): 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
'sgood
vsbad
skip
) 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--flake
flag on nix operations: allows overriding flake directory so you can use nix flake operations from e.g.git bisect run