Closed holly-hacker closed 4 months ago
We can log a warning if rustup is not installed and skip the check without stopping the CLI. It looks like there are specific directories that we can check for each platform for targets, but I don't if those locations are stable
Feature Request
I want to try out dioxus and tried to install the 0.5 alpha through a nix flake. I managed to get it to build, but it fails with the following error:
This error also appears when using the
dx
command to create a project, and when usingserve
rather thanbuild
.As I understand, this is because the dioxus cli invokes
rustup show
to check if thewasm32-unknown-unknown
target is installed: https://github.com/DioxusLabs/dioxus/blob/9241730d275ff849bb77751e6fc9241566b1dfcb/packages/cli/src/builder.rs#L102-L104I tried to add a
.context
call to this check to verify that this is the error but couldn't get it to build, but addingrustup
to mybuildInputs
does get past the error.For reproduction, here is my current flake:
flake.nix
```nix { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; flake-utils.url = "github:numtide/flake-utils"; rust-overlay = { url = "github:oxalica/rust-overlay"; inputs.nixpkgs.follows = "nixpkgs"; inputs.flake-utils.follows = "flake-utils"; }; }; outputs = { self, nixpkgs, flake-utils, rust-overlay, ... }: flake-utils.lib.eachDefaultSystem (system: let overlays = [ (import rust-overlay) ]; pkgs = import nixpkgs { inherit system overlays; }; dx = with pkgs; (rustPlatform.buildRustPackage rec { pname = "dioxus-cli"; version = "0.5.0-alpha.0"; cargoHash = "sha256-l/FOB1sUWQmHOZPfSJ0nJ3WZFInnwoh0n9Z00qfaa1k="; src = fetchCrate { inherit pname version; hash = "sha256-POEO5G0uw1y+FkV3HWi4ifhkEsFcGaY6VNABTm9C9+M="; }; doCheck = false; nativeBuildInputs = [ pkg-config cacert nasm ]; buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.CoreServices ]; OPENSSL_NO_VENDOR = 1; }); in with pkgs; rec { devShell = mkShell rec { nativeBuildInputs = [ (rust-bin.stable.latest.default.override { extensions = [ "rust-analyzer" "rust-src" ]; targets = [ "wasm32-unknown-unknown" ]; }) ]; buildInputs = []; # buildInputs = [ rustup ]; shellHook = '' PATH="${dx}/bin:$PATH" ''; }; }); } ```Implement Suggestion
Implement a different check to check for the
wasm32-unknown-unknown
target, or add an environment variable that allows bypassing this check.