Skip to content

Proving a refactor is neutral

A framework refactor changes no deployed system: the derivation (drvPath) of each host stays identical. just drv-diff checks this, from the root of a co-development project.

Fenêtre de terminal
just drv-diff # tout le parc
just drv-diff gw-main,nas # deux hôtes, pendant le travail
just drv-diff "" HEAD~3 # contre une révision antérieure de dnf/

The command evaluates each host twice: against the last commit of dnf/, then against the working tree. It lists the hosts whose derivation differs and exits with an error if there are any.

The working tree is read as just commit would commit it: tracked files and new files, except those git ignores. The consuming project is the same on both sides; only dnf/ varies.

A flake.lock of dnf/ that is modified but not yet committed (nix flake update) changes all hosts and would mask the effect of the code. The command reports it, then reads the working tree using the lock of the base revision.

Fenêtre de terminal
LOCK=tree just drv-diff # compter aussi la mise à jour des inputs

The output gives the two drvPath of each affected host. Comparing them shows what changed:

Fenêtre de terminal
nix run nixpkgs#nix-diff -- <avant.drv> <après.drv>

A wanted difference is no longer a refactor: the commit then carries the type feat or fix.

Two evaluations run one after the other, each on two processes. WORKERS changes their number, and WORKER_MEM (MB) caps the memory of each.

Fenêtre de terminal
WORKERS=1 just drv-diff