Is there a way to disable application of patches or should I use overrideAttr?

The ffmpeg generic package has arguments to change the version and the comment in the code says

NOTICE: Always use this argument to override the version. Do not use overrideAttrs.

But using ffmpeg.override seems to be pointless, because it still applies patches, that fail with newer/other versions:

applying patch /nix/store/w6l18vqp69adg0kikz7xdg8igqzv118d-rename_iszero
Fetching https://crates.io/api/v1/crates/png/0.17.16/download -> tarballs/png-0.17.16.tar.gz
patching file tests/checkasm/vp9dsp.c
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] 
Skipping patch.
2 out of 2 hunks ignored -- saving rejects to file tests/checkasm/vp9dsp.c.rej
error: builder for '/nix/store/dshypks8a17y118kfdymsa49r1r6ldr3-ffmpeg-headless-n7.1.1.drv' failed with exit code 1;
       last 10 log lines:
       > Running phase: unpackPhase
       > unpacking source archive /nix/store/dr00262f0i2fr7n1xjsqp4vj22ch8294-ffmpeg
       > source root is ffmpeg
       > Running phase: patchPhase
       > applying patch /nix/store/w6l18vqp69adg0kikz7xdg8igqzv118d-rename_iszero
       > patching file tests/checkasm/vp9dsp.c
       > Reversed (or previously applied) patch detected!  Assume -R? [n]
       > Apply anyway? [n]
       > Skipping patch.
       > 2 out of 2 hunks ignored -- saving rejects to file tests/checkasm/vp9dsp.c.rej
       For full logs, run 'nix log /nix/store/dshypks8a17y118kfdymsa49r1r6ldr3-ffmpeg-headless-n7.1.1.drv'.

Should I just ignore the comment and use overrideAttrs which works because patches are not applied anymore or is there some other idiomatic way that I am missing?

I am writing a package.nix where I need ffmpeg in a more recent version.

You probably want to use both in this case. First, call override to switch to another version, then call overrideAttrs on the result of that to disable patches.

2 Likes