mozilla / nixpkgs-mozilla

Mozilla overlay for Nixpkgs.
MIT License
529 stars 130 forks source link

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

Open Kreyren opened 3 years ago

Kreyren commented 3 years ago

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

nbp commented 3 years ago

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.