Standardize Cross-Compilation and Enable Pure Flakes#505
Open
petm5 wants to merge 7 commits into
Open
Conversation
talloc and proot are now built using LLVM and musl, using a native cross compiler toolchain from nixpkgs. The cross package environment is passed through the module system via crossPkgs. This allows flakes to be built without --impure.
Following the previous commit, we can now use crossPkgs and take advantage of nixpkgs' cross-compilation features to build the bootstrap zipball. This makes the custom cross-compiler infrastructure unnecessary, so remove it. The platform's native package set is now passed through the module system via targetPkgs. This lets us replace the Nix tarball download with a native package. Since store initialization does not happen at build time anymore, is now performed on the device during login-inner.
Collaborator
|
That's very interesting, should be landed after a release once I finally force myself to make one. Note to self: I also wonder whether it's posible to hop off musl/LLVM altogether with that SIGBUS fix. IIRC, the symptom that made us abandon glibc/GCC 7 years ago was also manifesting itself as an inexplicable SIGBUS: #6 (comment) |
Author
AFAIK the whole point of using musl is to enable static linking since glibc doesn't support it well. How would a dynamically-linked proot work without hacks like a custom Nix store path? |
Collaborator
|
sorry, right, I meant bionic/LLVM -> musl/GNU, the default for nixpkgs static compilation
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
These changes refactor the build pipeline for
talloc,proot-static, and the bootstrap zipball to use standard nixpkgs cross-compilation infra. By doing so, we remove the need for custom cross-compilation logic and allow system configurations without the--impureflag.Highlights:
prootis updated to preventSIGBUScrashes on aarch64 when built against musl and recent LLVM (termux/proot@28baec5).prootandtallocstore paths innixOnDroidConfigurationare replaced with a nixpkgs-native LLVM/musl cross toolchain. The same toolchain is used to build the bootstrap zipball.tallocpackage so it can be built outside of a cross-compilation environment.login-inner. This lets us avoid duplicating the logic ofnix-store --init.It is possible to specify what architecture will be used to cross-compile the static components. The idea is they could be built on an
x86_64-linuxsystem and stored in a binary cache so aarch64 devices can use them even if they can't be built natively.The changes were tested and validated on my own device (Samsung Galaxy A15) using a custom binary cache and bootstrap server. I could switch to a home-manager enabled profile without it throwing bus errors.
Further changes may be needed to maintain compatibility with the release scripts and GitHub Actions checks.