-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
Enable NixOS cross-compiling from aarch64-linux to x86_64-linux and vice versa #363935
Closed
+77
−28
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ges via make-disk-image
This reverts commit 391d3af.
github-actions
bot
added
6.topic: python
6.topic: nixos
Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS
6.topic: rust
labels
Dec 10, 2024
nix-owners
bot
requested review from
figsoda,
philiptaron,
RaitoBezarius,
winterqt and
zowoq
December 10, 2024 14:19
NixOSInfra
added
the
12. first-time contribution
This PR is the author's first one; please be gentle!
label
Dec 10, 2024
ofborg
bot
added
10.rebuild-darwin: 501+
10.rebuild-linux: 501+
and removed
2.status: merge conflict
This PR has merge conflicts with the target branch
labels
Dec 17, 2024
wegank
added
the
2.status: merge conflict
This PR has merge conflicts with the target branch
label
Dec 31, 2024
The PR was created with the wrong head branch selected (it's prinzdezibel:master instead of prinzdezibel:staging or prinzdezibel:feature-branch respectively). I'm going to close this one and create a new PR. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
2.status: merge conflict
This PR has merge conflicts with the target branch
6.topic: cross-compilation
Building packages on a different platform than they will be used on
6.topic: nixos
Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS
6.topic: python
6.topic: rust
10.rebuild-darwin: 5001+
10.rebuild-linux: 5001+
12. first-time contribution
This PR is the author's first one; please be gentle!
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Disk image cross compilation fails on ARM64
It's not possible to create cross-platform disk images with nixos/lib/make-disk-image, because runInLinuxVM does only support architectures with same CPU architecture.
Using binfmt emulation alone is not sufficient and will segfault when trying to build an image for x86_64 on aarch64 build machines. Segfaults also happened when I tried to build a barebone configuration with nixos-generators.
To sucessfully build cross-platform image modifications and several cross-compile fixes for the nixpkgs repository are necessary. The proposed changes allow make-disk-image to make usage of a fully fledged QEMU qemu-system-x86_64 instance with TCG fallback instead of the qemu-kvm package which only supports emulation of
machines with the same CPU architecture.
Reproduction of the error
Clone https://github.com/prinzdezibel/nixos-qemu-image
Enable official nixpkgs repository as flake input and disable this line
Enable next line
Necessary steps (find more detail more here)
Fix error: Switch to working nixpkgs repository
Nix-info
nix-shell -p nix-info --run "nix-info -m"
"aarch64-linux"
Linux 6.11.6-asahi, NixOS, 24.11 (Vicuna), 24.11.20241123.0c58267
yes
yes
nix-env (Nix) 2.24.10
""
/etc/nixpkgs/channels/nixpkgs
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.