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

Rust components not available when rust targets are specified #1223

Closed
wvffle opened this issue May 22, 2024 · 1 comment · Fixed by #1224
Closed

Rust components not available when rust targets are specified #1223

wvffle opened this issue May 22, 2024 · 1 comment · Fixed by #1224
Labels
bug Something isn't working

Comments

@wvffle
Copy link

wvffle commented May 22, 2024

Describe the bug
When I specify the targets for rust language, the rust components like cargo are never installed. When I specify channel that is other than nixpkgs, then the components are there.

To reproduce

# flake.nix
{
  description = "...";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

    flake-utils.url = "github:numtide/flake-utils";
    flake-utils.inputs.nixpkgs.follows = "nixpkgs";

    devenv.url = "github:cachix/devenv";
    devenv.inputs.nixpkgs.follows = "nixpkgs";

    flake-parts.url = "github:hercules-ci/flake-parts";
    flake-parts.inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs = inputs@{ flake-parts, nixpkgs, ... }:
    flake-parts.lib.mkFlake { inherit inputs; } {
      imports = [ inputs.devenv.flakeModule ];
      systems = nixpkgs.lib.systems.flakeExposed;

      perSystem = { config, pkgs, ... }: {
        devenv.shells.default = {
          languages.rust = {
            enable = true;
            targets = [ "wasm32-unknown-unknown" ];
          };
        };
      };
    };
}

When I try to check if cargo is present:

│❯❯❯ cargo                                                                                               ✘ 1  │
│The program 'cargo' is not in your PATH. It is provided by several packages.                                 │
│You can make it available in an ephemeral shell by typing one of the following:                              │
│  nix-shell -p cargo                                                                                         │
│  nix-shell -p cargo-auditable-cargo-wrapper                                                                 │
│  nix-shell -p rustup  

Version
devenv: 1.0.5

@wvffle wvffle added the bug Something isn't working label May 22, 2024
@sandydoo
Copy link
Member

You have to use the fenix toolchain when cross-compiling. I don't think there's tooling to do that within nixpkgs, but I could be wrong.
We'll add an error message for this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants