Skip to content

Conversation

@jla2000
Copy link

@jla2000 jla2000 commented Nov 15, 2025

I have created a nix flake, that will fetch the required rust toolchain using rust-overlay.
By doing this, the toolchain does not need to be installed into the user environment directly.
I also added an .envrc, this will allow to directly drop into a devshell if eg. direnv is used.

@LegNeato
Copy link
Collaborator

I don't know anything about nix, @eddyb ?

@alphastrata
Copy link
Contributor

not maintainer --but I think forcing everyone to pull in the android toolchain might be a bit of an ask no?

{
devShells = {
default = pkgs.callPackage ./shell.nix { inherit rustToolchain; };
android = pkgs.callPackage ./android.nix { inherit rustToolchain; };
Copy link
Member

Choose a reason for hiding this comment

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

@alphastrata This means you need to run nix develop .#android to get a dev shell with android, otherwise it'll just use default. (Though it wouldn't allow you to run the examples locally, since it's missing the deps that shell.nix provides... Maybe we should treat android as a purely additive thing?)

It looks good to me, but I'm not super familiar with nix myself, so I'll get @eddyb review it as well.

Copy link
Contributor

@alphastrata alphastrata Nov 19, 2025

Choose a reason for hiding this comment

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

Ahh I see. ty.

Copy link
Author

Choose a reason for hiding this comment

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

I'm not sure for what the android.nix was used for, I am assuming just to cross compile to android? If so, I think it's fine that it won't allow to run the examples per default as it was already like this before.

@jla2000
Copy link
Author

jla2000 commented Nov 19, 2025

One thing I am not sure about yet is how the rust-overlay flake input can be automatically updated when upgrading to a newer toolchain without forcing someone to use nix. With these changes, every time the rust toolchain is being updated, it would be necessary to run "nix flake update rust-overlay" as well to make sure the new toolchain version is known to nix.

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.

4 participants