Bisecting: Difference between revisions
add stub for article on using bisect in the nix context |
→Flakes: - nix-prefetch-url + nix-hash -> nix flake prefetch |
||
Line 14: | Line 14: | ||
Bisecting changes in a flake itself can just follow the regular bisecting process. | Bisecting changes in a flake itself can just follow the regular bisecting process. | ||
Bisecting regressions in [[flake]]s' inputs typically involves updating the dependency's <code>rev</code> and <code>narHash</code> in the <code>flake.lock</code> file. Using tools like <code>nix | Bisecting regressions in [[flake]]s' inputs typically involves updating the dependency's <code>rev</code> and <code>narHash</code> in the <code>flake.lock</code> file. Using tools like <code>nix flake prefetch</code>, <code>jq</code> and <code>sed</code>, this process [https://gist.github.com/KiaraGrouwstra/70bf11002032b3c265512f4e17607631#file-bisect-sh can be scripted]. |
Revision as of 15:38, 1 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, there are a few common use-cases for Nix.
nixpkgs
either:
- directly bisect, say from the root of the nixpkgs repository run
git bisect start --first-parent master nixos-24.05 && git bisect run nix build -f . lolcat
if packagelolcat
broke sincenixos-24.05
. This uses git bisect run to run the test until the culprit is found, while the--first-parent
flag selects merge commits, which in nixpkgs should be cached in Hydra. - nix-bisect: smartly pick
bisect bad/skip
in automated bisects and give nicer outputs - hydrasect: prioritize cached commits in nixpkgs bisects - unfortunately still lacks nix package/flake
- after each checkout run
git checkout $(hydrasect-search | head -1)
- after each checkout run
- nixpkgs-staging-bisecter: like hydrasect but minimize how many derivations you will build even in staging
Flakes
Bisecting changes in a flake itself can just follow the regular bisecting process.
Bisecting regressions in flakes' inputs typically involves updating the dependency's rev
and narHash
in the flake.lock
file. Using tools like nix flake prefetch
, jq
and sed
, this process can be scripted.