Skip to content
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

Make rust.nix accept toolchain options. #640

Closed
wants to merge 5 commits into from

Conversation

nothingnesses
Copy link

@nothingnesses nothingnesses commented Jun 2, 2023

This makes the Rust option accept toolchain override options in a similar format to rust-toolchain.toml, which should be more familiar to Rust users and allow adding arbitrary components and targets, and is a step forward to addressing #530.

Changes:

  • Remove languages.rust.packages and languages.rust.version options.
  • Make nix-community/fenix a hard-requirement for languages.rust.enable.
  • Add languages.rust.toolchain option.

This no longer includes rust-src by default and no longer has pre-commit hooks since the components may no longer be present. How should I handle rust-src and the pre-commit hooks instead?

According to the nix-community/fenix maintainer, rust-analyzer will automatically use the rust-src package if it exists. I've pushed a commit which causes the pre-commit hooks to use the rust components if they are added by the user, otherwise it defaults to the ones from nixpkgs.

Matrix conversation about the topic.

* Remove `languages.rust.packages` and `languages.rust.version` options.
* Make nix-community/fenix a hard-requirement for `languages.rust.enable`.
* Add ` languages.rust.toolchain` option.
@nothingnesses
Copy link
Author

nothingnesses commented Jun 7, 2023

I've added a commit to fix the failing tests, but I think the test will fail again when Rust updates which will require a new sha256 value. I haven't managed to come up with a good way to automatically generate these.

Edit: I've pushed another commit which should actually (hopefully) fix the Rust-related errors this time, as well as obviate the need to pass in a specific SHA256 value.

* This means that it won't work in restricted evaluation mode, but will no longer require passing in a specific SHA256 value.
* This should hopefully (actually) fix failing Rust language tests.
@nothingnesses
Copy link
Author

nothingnesses commented Jun 9, 2023

It seems like the only failing test related to Rust now is due to the VM running out of storage space (I think the rest of the errors are related to Racket or mesa instead). I'm wondering if maybe enabling cachix for fenix as per these instructions with cachix-action would help alleviate this. @figsoda Are derivation outputs produced by the fromToolchainFile function cached in fenix's cachix and do you think it's worth trying this?

@figsoda
Copy link
Contributor

figsoda commented Jun 9, 2023

Are derivation outputs produced by the fromToolchainFile function cached in fenix's cachix

they are not, only outputs that are derivations (without needing a function call) are cached

and do you think it's worth trying this?

I'm not sure if this is possible, since fromToolchainFile allows way too many permutations for all of them to be cached

@nothingnesses
Copy link
Author

Closing in favour of #667.

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.

None yet

2 participants