nixpkgs-mozilla icon indicating copy to clipboard operation
nixpkgs-mozilla copied to clipboard

Missing `rust-src` which is causing `rust-analyzer` to fatal in vscodium

Open Kreyren opened this issue 4 years ago • 1 comments

Afaik this is a component of rustup which is not used in this environment?

image

Nix-shell

# NixOS shell configuration to bootstrap the required dependencies
# NOTE(Krey): Uses mozilla's overlay, because nix's upstream is slow

let
	moz_overlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz);
	nixpkgs = import <nixpkgs> { overlays = [ moz_overlay ]; };
in
	with nixpkgs;
	stdenv.mkDerivation {
		name = "moz_overlay_shell";
		buildInputs = [
			# NOTE(Krey): Using nightly for 2021 edition
			(nixpkgs.rustChannelOf { date = "2021-08-15"; channel = "nightly"; }).rust
		];
	}
	

Editor

[nix-shell:~/Repositories/RiXotStudio/editors/nix/codium]$ cat default.nix 
#!/usr/bin/env nix-shell
# NixOS shell configuration to bootstrap the required dependencies and start the editor

with import <nixpkgs> {};
stdenv.mkDerivation {
	name = "RiXotStudio";
	buildInputs = [
		pkgs.vscodium-fhs
		pkgs.texlive.combined.scheme-full
	];
}

[kreyren@leonid:~/Repositories/RiXotStudio]$ ls "$(rustc --print sysroot)/bin"
cargo         cargo-fmt   clippy-driver  rls            rustc           rustdoc  rust-gdb     rust-lldb
cargo-clippy  cargo-miri  miri           rust-analyzer  rust-demangler  rustfmt  rust-gdbgui

May be relevant to https://github.com/rust-analyzer/rust-analyzer/issues/4172

Kreyren avatar Aug 16 '21 11:08 Kreyren

When using rust-analysis, you should explicit it as part of the extensions to be included:

  ((nixpkgs.rustChannelOf { date = "2021-08-15"; channel = "nightly"; }).rust.override (old:
      { extensions = ["rust-src" "rust-analysis"]; }))

Adding a bad extension name, such as "foo" will exit with an error containing the list of available extensions.

nbp avatar Nov 04 '21 19:11 nbp