Skip to content

First class cross#13073

Merged
xokdvium merged 3 commits intoNixOS:masterfrom
roberth:first-class-splicing
Jul 19, 2025
Merged

First class cross#13073
xokdvium merged 3 commits intoNixOS:masterfrom
roberth:first-class-splicing

Conversation

@roberth
Copy link
Member

@roberth roberth commented Apr 24, 2025

Motivation

Cross packaging shouldn't depend on having and using overlay.

This PR makes it possible to cross-compile without using any overlays whatsoever.

The three helper functions could perhaps be moved to Nixpkgs lib. cc @Ericson2314

See also commit messages.

Context

  • The packaging problems in hydra and flake.lock: Update Nixpkgs #13010 motivated me to try improve this again.

  • This must have been my third attempt at this. I had previously got stuck on a Nixpkgs quirk; see comment at fixup =.


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@roberth roberth requested a review from Ericson2314 April 24, 2025 00:12
@roberth roberth requested a review from edolstra as a code owner April 24, 2025 00:12
@roberth roberth force-pushed the first-class-splicing branch from d2c4405 to 281f6a8 Compare April 24, 2025 00:17
@roberth roberth added the build-problem Nix fails to compile or test; also improvements to build process label Apr 24, 2025
@roberth roberth force-pushed the first-class-splicing branch from 281f6a8 to d2227af Compare April 25, 2025 16:37
@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/2025-07-16-nix-team-meeting-minutes-235/66850/1

roberth added 3 commits July 19, 2025 16:27
This was carefully refactored by inlining some Nixpkgs definitions
like `generateSplicesForMkScope`, so the memoization properties
should remain the same.
Users can access these through the `lib.makeComponents` return value,
so it's helpful to briefly explain some of them.

This doesn't replace `meta.description`, but supplements it.
(TODO: improve `meta.description`)
We should keep users' pkgs tidy.
@xokdvium xokdvium force-pushed the first-class-splicing branch from d2227af to 9b9e49e Compare July 19, 2025 13:27
Copy link
Contributor

@xokdvium xokdvium left a comment

Choose a reason for hiding this comment

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

Won't pretend that I understand all the splicing nuances, but this seems like a great step in the right direction. For one, this will be very useful for our GHA CI. I really like that we'd be able to do (dummy example for simplicity):

lib.makeComponents { pkgs = import <nixpkgs> { }; getStdenv = pkgs: pkgs.clangStdenv; }).overrideScope (_: _: { mesonComponentOverrides = finalAttrs: prevAttrs: { env.CXXFLAGS = "-ftime-trace"; }; }

Just for a single GHA job to measure compile times with ClangBuildAnalyzer. I suppose there are countless other applications for this as well. Having a single entry-point to the package set will really allow us the clean up the checks as well as hydraJobs when we need to build with sanitizers and other overrides.

Copy link
Contributor

@xokdvium xokdvium left a comment

Choose a reason for hiding this comment

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

Paths for components that don't depend on fineVersion are the same for cross. NIX_SHOW_STATS are also basically the same, so LGTM.

@xokdvium xokdvium merged commit c70e143 into NixOS:master Jul 19, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-problem Nix fails to compile or test; also improvements to build process

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants