From 154f4693b95591112f77ae07ef511f09dbba8bc8 Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Thu, 2 Jul 2026 18:11:51 +0300 Subject: [PATCH] ffmpeg: don't clobber clang build with unwrapped compiler This is my SNAFU from 817b0e1338faca6deebeb9fca8beeef8409dbeea. In a clang stdenv the host compiler would be the unwrapped clang, obviously breaking things. This has caused issues on darwin [1]. pkgsLLVM.ffmpeg-headless seems broken, but I tested this on darwin without #531960 fix and it did the trick. [1]: https://github.com/NixOS/nixpkgs/pull/531960 --- pkgs/development/libraries/ffmpeg/generic.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix index 46a32fec2e7e..d036b01bb5c9 100644 --- a/pkgs/development/libraries/ffmpeg/generic.nix +++ b/pkgs/development/libraries/ffmpeg/generic.nix @@ -249,7 +249,6 @@ celt, chromaprint, codec2, - clang, dav1d, davs2, fdk_aac, @@ -805,6 +804,10 @@ stdenv.mkDerivation ( "--cc=${stdenv.cc.targetPrefix}clang" "--cxx=${stdenv.cc.targetPrefix}clang++" ] + ++ optionals withCudaLLVM [ + # Unwrapped compiler because it will be retargeted and used freestanding with --cuda-device-only. + "--nvcc=${lib.getExe buildPackages.clang.cc}" + ] ++ optionals withMetal [ "--metalcc=${xcode}/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal" "--metallib=${xcode}/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metallib" @@ -834,7 +837,6 @@ stdenv.mkDerivation ( ++ optionals stdenv.hostPlatform.isx86 [ nasm ] # Texinfo version 7.1 introduced breaking changes, which older versions of ffmpeg do not handle. ++ optionals (lib.versionAtLeast version "6") [ texinfo ] - ++ optionals withCudaLLVM [ clang.cc ] ++ optionals withCudaNVCC [ cuda_nvcc ] # TODO: Clean up on `staging`. ++ optionals stdenv.hostPlatform.isDarwin [ llvmPackages.lld ];