Skip to content

Conversation

@joncinque
Copy link
Collaborator

Problem

Recreation of #139.

More information at anza-xyz/platform-tools#109, but Rust is currently built with a few additional shared libraries.

Summary of changes

Add a --nix flag to build.sh to optionally build with nix-shell.

#### Problem

Recreation of anza-xyz#139.

More information at anza-xyz/platform-tools#109,
but Rust is currently built with a few additional shared libraries.

#### Summary of changes

Add a `--nix` flag to build.sh to optionally build with nix-shell.
./x.py build --stage 1 --target ${HOST_TRIPLE},sbf-solana-solana,sbpf-solana-solana,sbpfv1-solana-solana,sbpfv2-solana-solana,sbpfv3-solana-solana,sbpfv4-solana-solana

if [ -n "${WITH_NIX}" ]; then
nix-shell src/tools/nix-dev-shell/shell.nix --pure --run "x build --stage 1 --target sbf-solana-solana,sbpf-solana-solana,sbpfv1-solana-solana,sbpfv2-solana-solana,sbpfv3-solana-solana,sbpfv4-solana-solana"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this be x.py?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

nope! x is also a rust binary just for building in the nix environment: https://github.com/anza-xyz/rust/blob/solana-1.89.0/src/tools/nix-dev-shell/x/x.rs

build.sh Outdated
Comment on lines 11 to 23
case "$1" in
--nix)
WITH_NIX=1
shift
;;
--llvm)
REBUILD_LLVM=1
shift
;;
--help)
echo "--llvm to rebuild llvm, --nix to use nix";
exit;
esac
Copy link
Collaborator

Choose a reason for hiding this comment

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

This means --nix and --llvm can't be used together. I don't think this is much of a hassle, so if you are OK with that, we can merge as it is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oops sorry, you're right, wrapped this in a while loop!

@LucasSte LucasSte merged commit 88a5a9f into anza-xyz:solana-1.89.0 Oct 17, 2025
15 checks passed
@joncinque joncinque deleted the nix-build-new branch October 17, 2025 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants