refactor(nix): replace manual bindgen env with rustPlatform.bindgenHook#1255
Open
xilec wants to merge 1 commit intocjpais:mainfrom
Open
refactor(nix): replace manual bindgen env with rustPlatform.bindgenHook#1255xilec wants to merge 1 commit intocjpais:mainfrom
xilec wants to merge 1 commit intocjpais:mainfrom
Conversation
Replace hand-crafted LIBCLANG_PATH and BINDGEN_EXTRA_CLANG_ARGS with rustPlatform.bindgenHook, which reads the correct include paths (including libc.dev) from the cc-wrapper automatically.
2f88dd3 to
e03200a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LIBCLANG_PATHandBINDGEN_EXTRA_CLANG_ARGSwithrustPlatform.bindgenHookllvmPackages.libclangfrom both package and devShell inputsbindgenHookis a standard nixpkgs setup hook that reads include paths (includinglibc.dev) from the cc-wrapper automatically. It's simpler, less error-prone, and consistent with how other Rust+bindgen packages in nixpkgs handle it (e.g.atuin-desktop).Context: while reviewing the nixpkgs upstream PR (NixOS/nixpkgs#507754), I discovered that manually setting
BINDGEN_EXTRA_CLANG_ARGSwith${stdenv.cc.libc}/includeinstead of${stdenv.cc.libc.dev}/includesilently breaks Vulkan bindgen —bindgenHookavoids this class of bugs entirely.Test plan
nix build .#handysucceeds