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

stdenvNoCC: drop extraBuildInputs on Darwin #392695

Merged
merged 1 commit into from
Mar 24, 2025

Conversation

reckenrode
Copy link
Contributor

Darwin includes its SDK in extraBuildInputs, which isn’t needed in stdenvNoCC because it depends on a compiler. Including it greatly increases the size of the stdenvNoCC closure (by ~1 GiB).

This wasn’t an issue in the past when darwin included CoreFoundation because CoreFoundation on its own is very small. Now that it includes the whole SDK and links some bintools, it pulls in 300~400 MiB for the SDK plus another ~445 MiB for LLVM.

Fixes #371465

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/)
  • 25.05 Release Notes (or backporting 24.11 and 25.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 Mar 24, 2025
@reckenrode reckenrode added the backport staging-24.11 Backport PR automatically label Mar 24, 2025
@reckenrode
Copy link
Contributor Author

Technically, this is a breaking change because something may depend on the presence of the SDK even without a compiler. I reviewers feel strongly about it, I can drop the backport. On the other hand, having the SDK in the dev shell creates a bad experience for users who expect mkShellNoCC not to mess with their native toolchains.

@nix-owners nix-owners bot requested a review from Ericson2314 March 24, 2025 12:09
@reckenrode reckenrode removed the backport staging-24.11 Backport PR automatically label Mar 24, 2025
@reckenrode
Copy link
Contributor Author

Dropping the backport label at @emilazy’s recommendation since we’re half-way through the stable cycle, and this is a breaking change. Users who need a no-CC dev shell should either use unstable or use the following override on stable (24.11).

mkShellNoCC = pkgs.mkShellNoCC.override {
  stdenv = pkgs.stdenvNoCC.override { extraBuildInputs = [ ]; };
};

Darwin includes its SDK in `extraBuildInputs`, which isn’t needed in
`stdenvNoCC` because it depends on a compiler.  Including it greatly
increases the size of the `stdenvNoCC` closure (by ~1 GiB).

This wasn’t an issue in the past when darwin included CoreFoundation
because CoreFoundation on its own is very small.  Now that it includes
the whole SDK and links some bintools, it pulls in 300~400 MiB for the
SDK plus another ~445 MiB for LLVM.

Fixes NixOS#371465
@github-actions github-actions bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Mar 24, 2025
Copy link
Member

@ethancedwards8 ethancedwards8 left a comment

Choose a reason for hiding this comment

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

Idea LGTM and connects some dots surrounding mkShellNoCC and why I've had issues in the past. I cannot comment on backwards compatibility or breaking changes.

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.

Wish we didn’t have to put platform‐specific concerns here, but looks good.

@emilazy emilazy merged commit 2e7f4d3 into NixOS:staging Mar 24, 2025
23 of 27 checks passed
@reckenrode reckenrode deleted the push-opmoszmpwqup branch March 24, 2025 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: darwin Running or building packages on Darwin 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants