Skip to content

docs - modernized nix linux dependencies example#24301

Open
octocron wants to merge 1 commit into
bevyengine:mainfrom
octocron:docs-improved-nix-example
Open

docs - modernized nix linux dependencies example#24301
octocron wants to merge 1 commit into
bevyengine:mainfrom
octocron:docs-improved-nix-example

Conversation

@octocron

Copy link
Copy Markdown

Objective

  • Changed buildInputs to packages (recommended way for mkShell since 22.05)
  • Removed outdated RUST_SRC_PATH no longer needed as rust-analyzer added to extension list
  • pkg-config moved to nativeBuildInputs because it is a build time tool, not a runtime library (package - buildInput)
  • Use stdenv.isLinux instead of (lib.strings.hasInfix "linux" system) as it is cleaner, clearer and safer
  • Made LD_LIBRARY_PATH part of platform check

Solution

  • Updates the Nix example in the Linux dependencies documentation to use current best practices:
  • Uses packages instead of the older buildInputs in mkShell
  • Moves pkg-config to its proper place: nativeBuildInputs
  • Uses stdenv.isLinux for platform checks

Testing

Test flake: https://gitlab.com/megacron/echo-chamber

  • This code was tested in both Nixos and Mac environments using nix develop.
  • It made the devshell environments properly for both platforms.
  • Successfully ran cargo check and cargo run on both linux and macos with bevy window spawn, no errors.

…st-analyzer, pkg-config moved to nativeBuildInputs, use stdenv.isLinux as safer
@github-actions

Copy link
Copy Markdown
Contributor

Welcome, new contributor!

Please make sure you've read our contributing guide, as well as our policy regarding AI usage, and we look forward to reviewing your pull request shortly ✨

@mnmaita mnmaita added C-Docs An addition or correction to our documentation O-Linux Specific to the Linux desktop operating system A-Meta About the project itself S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels May 16, 2026
@alice-i-cecile alice-i-cecile requested a review from NthTensor May 21, 2026 13:05

@SpecificProtagonist SpecificProtagonist left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm far from a nix expert, but – trying it out on NixOS – this works and the changes seem sensible to me.

@RLangendam

Copy link
Copy Markdown

Instead of putting this in the documentation, why don't we create the flake.nix and flake.lock at the repository root? This way we can transition the CI builds to use it and we have reproducible builds.

@RLangendam

Copy link
Copy Markdown

Instead of putting this in the documentation, why don't we create the flake.nix and flake.lock at the repository root? This way we can transition the CI builds to use it and we have reproducible builds.

Created a new PR (with slightly improved flake compared to the docs): #24872

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Meta About the project itself C-Docs An addition or correction to our documentation O-Linux Specific to the Linux desktop operating system S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants