Skip to content

Commit

Permalink
RUST_SRC_PATH should use the overlay
Browse files Browse the repository at this point in the history
Also install rust-analysis and rls via nix, so that the user doesn't need to rely on the VSCode extension to download a static binary.
  • Loading branch information
srid committed Apr 13, 2021
1 parent 2f00d8d commit 0de7a6e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
let
# If you change the name here, you must also do it in Cargo.toml
name = "rust-nix-template";
rustChannel = "stable";
in
utils.lib.eachDefaultSystem
(system:
Expand All @@ -35,8 +36,8 @@
# Because rust-overlay bundles multiple rust packages into one
# derivation, specify that mega-bundle here, so that crate2nix
# will use them automatically.
rustc = self.rust-bin.stable.latest.default;
cargo = self.rust-bin.stable.latest.default;
rustc = self.rust-bin.${rustChannel}.latest.default;
cargo = self.rust-bin.${rustChannel}.latest.default;
})
];
};
Expand Down Expand Up @@ -87,9 +88,10 @@
[
nixpkgs-fmt
cargo-watch
pkgs.rust-bin.${rustChannel}.latest.rust-analysis
pkgs.rust-bin.${rustChannel}.latest.rls
]);
# FIXME: Is this correct? Should it use rust-overlay instead?
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
RUST_SRC_PATH = "${pkgs.rust-bin.${rustChannel}.latest.rust-src}/lib/rustlib/src/rust/library";
};
}
);
Expand Down

0 comments on commit 0de7a6e

Please sign in to comment.