Replies: 1 comment
-
|
Oh, in _module.args.setupCraneLib = { withWasm32 }:
let
fenixPkgs = inputs'.fenix.packages;
hostRustToolchain = fenixPkgs.fromManifestFile inputs.rust-manifest;
# See https://rust-lang.github.io/rustup/concepts/components.html:
hostRustComponents = with hostRustToolchain; [
# I have been using stable manifests, not all those components
# might be available on other types of releases.
cargo
clippy
llvm-tools
rust-analyzer
rustc
rust-docs
rustfmt
rust-src
rust-std
];
# Let's add (combine with) wasm32-unknown-unknown.rust-std
# so that we can use `trunk`to build the frontend:
wasmTarget = fenixPkgs.targets.wasm32-unknown-unknown;
wasmRustToolchain = wasmTarget.fromManifestFile inputs.rust-manifest;
rustToolchain = fenixPkgs.combine (
hostRustComponents
++ pkgs.lib.optionals withWasm32 [ wasmRustToolchain.rust-std ]
);
craneLib = inputs.crane.lib.${system};
in
(craneLib.overrideToolchain rustToolchain).overrideScope (_final: _prev: {
# The version of wasm-bindgen-cli needs to match the version in
# Cargo.lock. You can unpin this if your nixpkgs commit contains the
# appropriate wasm-bindgen-cli version.
#
# NOTE(louis@2024-04-16): Maybe we could override the version, or
# use an overlay, directly onto our nixpkgs so that we don't have
# to download two different nixpkgs. I cargo-culted this from the
# crane template for trunk.
inherit (inputs'.nixpkgs-for-wasm-bindgen.legacyPackages) wasm-bindgen-cli;
});And I can get a single This could eventually move to some kind of flake module of its own. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am using flake-parts in a Rust project, and I have a couple flake modules that build Rust packages. I am using fenix to assemble, and pin my Rust toolchain, and I am using crane to build the Rust packages.
I currently have the following snippet:
Then from
perSystemI can do:I wish, I did not have to repeat that in every
perSystemfunction, how could I do that?Beta Was this translation helpful? Give feedback.
All reactions