Skip to content

python3Packages.libapparmor: fix cross compilation - #476808

Merged
GrimmTheShrimp merged 1 commit into
NixOS:masterfrom
uninsane:pr-py3_libapparmor-cross
Jul 14, 2026
Merged

GrimmTheShrimp merged 1 commit into
NixOS:masterfrom
uninsane:pr-py3_libapparmor-cross

Conversation

@uninsane

@uninsane uninsane commented Jan 4, 2026

Copy link
Copy Markdown
Contributor

fixes nix-build -A pkgsCross.aarch64-multiplatform.python3Packages.libapparmor

the previous code was supplying unspliced python (as a buildInput) and setuptools (as a nativeBuildInput) all from the same package set. in the case of
pkgsCross.aarch64-multiplatform.python3Packages.libapparmor, that results in an aarch64 setuptools hook attempting to be run on the (x86_64) build machine.

by going through callPackage, we can supply pkgs.libapparmor with spliced versions of these inputs that are suitable for either buildInputs/nativeBuildInputs/etc.

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

the previous code was supplying unspliced `python` (as a buildInput)
and `setuptools` (as a nativeBuildInput) all from the same package set.
in the case of
`pkgsCross.aarch64-multiplatform.python3Packages.libapparmor`, that
results in an aarch64 `setuptools` hook attempting to be run on the
(x86_64) build machine.

by going through `callPackage`, we can supply `pkgs.libapparmor` with
spliced versions of these inputs that are suitable for either
buildInputs/nativeBuildInputs/etc.
@uninsane uninsane added 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: cross-compilation Building packages on a different platform than they will be used on labels Jan 4, 2026
@nixpkgs-ci
nixpkgs-ci Bot requested a review from natsukium January 4, 2026 10:07
@nixpkgs-ci nixpkgs-ci 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 Jan 4, 2026
@Sigmanificient

Copy link
Copy Markdown
Member

is this specifically caused by the use of python3Packages = self or is it because of the toPythonModule without callPackage?
In any case i think this could be apply to other packages

@uninsane

uninsane commented Jan 4, 2026

Copy link
Copy Markdown
Contributor Author

is this specifically caused by the use of python3Packages = self or is it because of the toPythonModule without callPackage?

i think there's nothing problematic with toPythonModule. the issue is when we pass packages within self into places that want something other than the pkgsHostTarget platform, i.e. they want to put the package into nativeBuildInputs or depsBuildBuild etc. at that point, we have to go through self.callPackage, which does the splicing.

and yes: i expect there are other failing python packages that could be fixed with this same pattern. just searching for .override would probably get you 80% of them.

@uninsane uninsane mentioned this pull request Jan 5, 2026
3 of 13 tasks
@GrimmTheShrimp
GrimmTheShrimp self-requested a review January 5, 2026 08:38
@nixpkgs-ci nixpkgs-ci Bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 5, 2026

@GrimmTheShrimp GrimmTheShrimp 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.

Thats an interesting pattern i have never seen before, but it seems to work at least 🤷

Confirmed the exec format error and the fix, sorry i took so long getting to this

@GrimmTheShrimp
GrimmTheShrimp added this pull request to the merge queue Jul 14, 2026
Merged via the queue into NixOS:master with commit 0ab1e09 Jul 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: python Python is a high-level, general-purpose programming language. 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