nix-diff-1.0.21: Explain why two Nix derivations differ
Safe HaskellSafe-Inferred
LanguageGHC2021

Nix.Diff.Transformations

Contents

Synopsis

Documentation

foldAlreadyComparedSubTrees :: DerivationDiff -> DerivationDiff Source #

In large diffs there may be a lot of derivations that doesn't change at all, but changed some of its nested inputs, that was already compared. This case will produce "stairs" of useless reports: ``` • The input derivation named a differs - nixstore/j1jmbxd74kzianaywml2nw1ja31a00r5-a.drv:{out} + nixstore/ww51c2dha7m5l5qjzh2rblicsamkrh62-a.drv:{out} • The input derivation named b differs - nixstore/j1jmbxd74kzianaywml2nw1ja31a00r5-b.drv:{out} + nixstore/ww51c2dha7m5l5qjzh2rblicsamkrh62-b.drv:{out} • The input derivation named c differs • These two derivations have already been compared ``` This transformation will fold all these subtrees of diff into one OnlyAlreadyComparedBelow.

foldManyInputDerivationsAlreadyCompared :: DerivationDiff -> DerivationDiff Source #

If packages deep in the dependency graph have been changed, many other derivations will also change in an uninteresting manner. This can lead to hundreds or thousands of lines of output like this:

``` • The input derivation named `bash-5.2p32` differs • These two derivations have already been compared • The input derivation named `ensure-newer-sources-hook` differs • These two derivations have already been compared • The input derivation named `pypa-install-hook` differs • These two derivations have already been compared ```

This transformation will fold sequences of OneDerivationDiff like this into a single ManyDerivationsAlreadyComparedDiff.

squashSourcesAndEnvsDiff :: DerivationDiff -> DerivationDiff Source #

This transformation is most useful for --json output, because it will sqash a lot of `{"content":" ","type":Both},{"content":When,"type":Both},{"content":" ","type":Both},{"content":"in","type":Both},{"content":" ","type":Both}` into one `{"content":" When in ","type":Both}` block.

To understand this problem clearer, see `golden-testsexpected-outputsjson` and `golden-testsexpected-outputsjson-squashed`.

_Warning_: this transformation can break some parts of printing in human readable mode.

Helpers