Skip to content

Demonstrate how to use custom Rust toolchains #61

@zmitchell

Description

@zmitchell

For Rust projects that need to target architectures other than the architecture of their machine, you typically install support for those targets with rustup. Similarly, if you need to use the nightly compiler you would install and manage that with rustup as well. With Flox you want a declarative way to manage the project's dependencies. One solution for this is to use a flake.

Using the fenix flake you can do both of these things. For the nightly toolchain you only need nightly-rust.flake = "github:nix-community/fenix#default.toolchain" instead of the packages in the rust-toolchain of the existing example environment. To support other targets you need to write your own flake. The packages output of your flake would look something like this (I think):

packages.${system}.withWasm =
    fenix.${system}.packages.combine [
        fenix.${system}.packages.stable
        fenix.${system}.packages.targets.wasm32-unknown-unknown.default
    ];

and then you would add that flake to your manifest.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions