diff --git a/nix/crate-overrides.nix b/nix/crate-overrides.nix index e727f311..36fee1d1 100644 --- a/nix/crate-overrides.nix +++ b/nix/crate-overrides.nix @@ -20,26 +20,23 @@ defaultCrateOverrides rav1e = attrs: { env.CARGO_ENCODED_RUSTFLAGS = "-C target-feature=-crt-static"; }; ffmpeg-sys-next = attrs: { - nativeBuildInputs = (attrs.nativeBuildInputs or []) ++ [ + nativeBuildInputs = [ pkg-config ]; - buildInputs = (attrs.buildInputs or []) ++ [ - llvmPackages.libclang - ffmpeg.dev - gcc.cc - gcc-unwrapped - stdenv + buildInputs = [ + rustPlatform.bindgenHook + ffmpeg ]; - env = (attrs.env or {}) // { - LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; - CPATH = "${gcc-unwrapped}/lib/gcc/${stdenv.hostPlatform.config}/${gcc-unwrapped.version}/include"; - BINDGEN_EXTRA_CLANG_ARGS = builtins.concatStringsSep " " [ - "-I${gcc.libc.dev}/include" - "-I${gcc}/lib/gcc/x86_64-unknown-linux-gnu/${gcc.version}/include" - "-I${llvmPackages.libclang.lib}/lib/clang/${llvmPackages.libclang.version}/include" - ]; - PKG_CONFIG_PATH = "${ffmpeg.dev}/lib/pkgconfig"; - }; + }; + + ffmpeg-next = attrs: { + # Somehow the variables that are passed are mangled, so they are not + # correctly passed to the ffmpeg-next build script. Worth investigating + # more since it's probably a bug in crate2nix or buildRustCrate. + postPatch = '' + substituteInPlace build.rs \ + --replace-fail "DEP_FFMPEG_" "DEP_FFMPEG_SYS_NEXT_" + ''; }; grpc-metadata = attrs: {