Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mesa: split out the Darwin build into a separate expression #319047

Merged
merged 3 commits into from
Jun 18, 2024

Conversation

K900
Copy link
Contributor

@K900 K900 commented Jun 11, 2024

The way we build Mesa for Linux (and potentially others) is very, very different from the way we build Mesa on Darwin. In short, on Linux we generally want to build as much of it as possible, while on Darwin we want to build just enough of it to get GLX for legacy X applications.

So, split out the Darwin build into its own expression entirely, and give it just enough inputs and just enough feature flags to actually do the one thing we want it to do, and nothing else.

Then use the newly gained flexibility to remove most of the platform conditionals from the Linux expression.

Description of changes

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@ofborg ofborg bot added the 6.topic: darwin Running or building packages on Darwin label Jun 11, 2024
@K900
Copy link
Contributor Author

K900 commented Jun 11, 2024

Re-added split outputs to the Darwin expression to make libGL stubs build again.

Copy link
Contributor

@philiptaron philiptaron left a comment

Choose a reason for hiding this comment

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

Read through the Nix code carefully and built on x86_64-darwin x86_64-linux. Couple of in-no-way-blocking comments.

ofBorg is unhappy, though, due to pkgs/development/libraries/libva/default.nix on Darwin. (It's marked as unsupported, but it doesn't eval with this PR.)

pkgs/development/libraries/mesa/default.nix Outdated Show resolved Hide resolved
pkgs/top-level/all-packages.nix Outdated Show resolved Hide resolved
pkgs/development/libraries/mesa/default.nix Show resolved Hide resolved
@vcunat
Copy link
Member

vcunat commented Jun 11, 2024

@ofborg eval

@vcunat
Copy link
Member

vcunat commented Jun 11, 2024

ofBorg is still broken. An assertion on the right place would do it, I think. Or maybe there's some better way.

@K900 K900 requested a review from emilylange as a code owner June 11, 2024 18:37
@K900 K900 changed the base branch from staging-next to staging June 11, 2024 18:37
@K900
Copy link
Contributor Author

K900 commented Jun 11, 2024

Retargeted to next staging, current staging is unblocked by horrible hack.

@K900 K900 force-pushed the mesa-chop branch 8 times, most recently from 5edc006 to b410040 Compare June 15, 2024 06:48
K900 added 3 commits June 15, 2024 11:07
mesa.drivers is basically an implementation detail and should never be used
as a dependency of other expressions. It also no longer exists on Darwin.

mesa.osmesa is very niche and should generally be avoided.

mesa.libdrm is used in exactly one place and it's irrelevant there.
…clean up Linux

The way we build Mesa for Linux (and potentially others) is very,
very different from the way we build Mesa on Darwin. In short,
on Linux we generally want to build as much of it as possible,
while on Darwin we want to build just enough of it to get GLX
for legacy X applications.

So, split out the Darwin build into its own expression entirely,
and give it just enough inputs and just enough feature flags to
actually do the one thing we want it to do, and nothing else.

The Linux expression can be simplified further now, but that
would cause rebuilds, so we'll have to do that later.
@philiptaron
Copy link
Contributor

On x86_64-darwin, I went through each of these derivations and tried to build them directly. The only one that failed to build also failed to build on master: nix-build -A python3Packages.pyopencl.

I did not try to build on x86_64-linux yet.

Copy link
Member

@emilazy emilazy left a comment

Choose a reason for hiding this comment

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

I hacked up glxgears to build on macOS and got a blazing 12445.432 FPS on XQuartz with this PR applied. LGTM

@K900 K900 merged commit 00e78b2 into NixOS:staging Jun 18, 2024
28 checks passed
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/errors-out-of-the-box/48885/2

@Ninlives
Copy link
Contributor

Ninlives commented Aug 9, 2024

This PR breaks mesa build on riscv, as the valgrind is currently not supported on riscv, and the option for removing it from the buildInputs is deleted in this PR.

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

Successfully merging this pull request may close these issues.

7 participants