From 9ad38b5b4c530d5f9738afb0e0bc6e093b131660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Neumann?= Date: Tue, 10 Feb 2026 10:17:02 +0100 Subject: [PATCH] ffmpeg: Add a -bare variant Some packages, like unpaper, need a very basic ffmpeg installation without any external codec dependencies, because they do nothing more than pixel / picture manipulation. --- pkgs/development/libraries/ffmpeg/default.nix | 2 ++ pkgs/development/libraries/ffmpeg/generic.nix | 19 +++++++++++++------ pkgs/top-level/all-packages.nix | 2 ++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/pkgs/development/libraries/ffmpeg/default.nix b/pkgs/development/libraries/ffmpeg/default.nix index 0e82e63014c1..1e29fa97f2ec 100644 --- a/pkgs/development/libraries/ffmpeg/default.nix +++ b/pkgs/development/libraries/ffmpeg/default.nix @@ -54,6 +54,7 @@ rec { ffmpeg_8 = mkFFmpeg v8 "small"; ffmpeg_8-headless = mkFFmpeg v8 "headless"; ffmpeg_8-full = mkFFmpeg v8 "full"; + ffmpeg_8-bare = mkFFmpeg v8 "bare"; # Please make sure this is updated to new major versions once they # build and work on all the major platforms. If absolutely necessary @@ -68,4 +69,5 @@ rec { ffmpeg = ffmpeg_8; ffmpeg-headless = ffmpeg_8-headless; ffmpeg-full = ffmpeg_8-full; + ffmpeg-bare = ffmpeg_8-bare; } diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix index 203052505e5e..fc1f2277be08 100644 --- a/pkgs/development/libraries/ffmpeg/generic.nix +++ b/pkgs/development/libraries/ffmpeg/generic.nix @@ -22,6 +22,11 @@ ffmpegVariant ? "small", # Decides which dependencies are enabled by default + # Build nothing by default. Enable all features that are needed. + # To be used for purposes that don't require external dependencies, like `unpaper` + # that uses ffmpeg for image processing. + withBareDeps ? ffmpegVariant == "bare" || withHeadlessDeps, + # Build with headless deps; excludes dependencies that are only necessary for # GUI applications. To be used for purposes that don't generally need such # components and i.e. only depend on libav @@ -52,7 +57,7 @@ withAvisynth ? withFullDeps, # AviSynth script files reading withBluray ? withHeadlessDeps, # BluRay reading withBs2b ? withFullDeps, # bs2b DSP library - withBzlib ? withHeadlessDeps, + withBzlib ? withBareDeps, withCaca ? withFullDeps, # Textual display (ASCII art) withCdio ? withFullDeps && withGPL, # Audio CD grabbing withCelt ? withFullDeps, # CELT decoder @@ -169,7 +174,7 @@ withXml2 ? withHeadlessDeps, # libxml2 support, for IMF and DASH demuxers withXvid ? withHeadlessDeps && withGPL, # Xvid encoder, native encoder exists withZimg ? withHeadlessDeps, - withZlib ? withHeadlessDeps, + withZlib ? withBareDeps, withZmq ? withFullDeps, # Message passing withZvbi ? withHeadlessDeps, # Teletext support @@ -201,14 +206,14 @@ buildQtFaststart ? withFullDeps, # Build qt-faststart executable withBin ? buildFfmpeg || buildFfplay || buildFfprobe || buildQtFaststart, # Library options - buildAvcodec ? withHeadlessDeps, # Build avcodec library + buildAvcodec ? withBareDeps, # Build avcodec library buildAvdevice ? withHeadlessDeps, # Build avdevice library buildAvfilter ? withHeadlessDeps, # Build avfilter library - buildAvformat ? withHeadlessDeps, # Build avformat library + buildAvformat ? withBareDeps, # Build avformat library # Deprecated but depended upon by some packages. # https://github.com/NixOS/nixpkgs/pull/211834#issuecomment-1417435991) buildAvresample ? withHeadlessDeps && lib.versionOlder version "5", # Build avresample library - buildAvutil ? withHeadlessDeps, # Build avutil library + buildAvutil ? withBareDeps, # Build avutil library # Libpostproc is only available on versions lower than 8.0 # https://code.ffmpeg.org/FFmpeg/FFmpeg/commit/8c920c4c396163e3b9a0b428dd550d3c986236aa buildPostproc ? withHeadlessDeps && lib.versionOlder version "8.0", # Build postproc library @@ -394,6 +399,7 @@ let in assert lib.elem ffmpegVariant [ + "bare" "headless" "small" "full" @@ -992,7 +998,8 @@ stdenv.mkDerivation ( }; # tests linking broken with shaderc after https://github.com/NixOS/nixpkgs/pull/477464/changes/5a47b12dfcd1b909ba35778a866394430054319a - doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform && !withShaderc; + # tests need at least the headless deps to compile + doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform && !withShaderc && withHeadlessDeps; # Fails with SIGABRT otherwise FIXME: Why? checkPhase = diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6155a0f10347..883bbc7d384b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6405,9 +6405,11 @@ with pkgs; ffmpeg_8 ffmpeg_8-headless ffmpeg_8-full + ffmpeg_8-bare ffmpeg ffmpeg-headless ffmpeg-full + ffmpeg-bare ; fftwSinglePrec = fftw.override { precision = "single"; };