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: add evcxr & rust-src toolchain component #12

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions rust/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@
rustToolchain =
let
rust = super.rust-bin;
toolchain =
if builtins.pathExists ./rust-toolchain.toml then
Copy link
Contributor

@lucperkins lucperkins May 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work too?

(if builtins.pathExists ./rust-toolchain.toml then
  rust.fromRustupToolchainFile ./rust-toolchain.toml
else if builtins.pathExists ./rust-toolchain then
  rust.fromRustupToolchainFile ./rust-toolchain
else
  rust.stable.latest.default).override { extensions = [ "rust-src" ]; }

Copy link
Contributor Author

@nothingmuch nothingmuch May 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on second thought, if a rust toolchain file is provided then it should be trusted WRT which components to use? (edit to clarify: maybe only rust.stable.latest.default.override { extensions = [ "rust-src" ] } should be used eliminating the need for let or parens, or more complex and seemingly still wrong but less wrong, append "rust-src" to rust-toolchain.toml component list?)

rust.fromRustupToolchainFile ./rust-toolchain.toml
else if builtins.pathExists ./rust-toolchain then
rust.fromRustupToolchainFile ./rust-toolchain
else
rust.stable.latest.default;
in
if builtins.pathExists ./rust-toolchain.toml then
rust.fromRustupToolchainFile ./rust-toolchain.toml
else if builtins.pathExists ./rust-toolchain then
rust.fromRustupToolchainFile ./rust-toolchain
else
rust.stable.latest.default;
toolchain.override {
extensions = [ "rust-src" ]; # https://github.com/the-nix-way/dev-templates/issues/4
};
})
];

Expand All @@ -44,6 +48,7 @@
cargo-edit
cargo-watch
rust-analyzer
evcxr
];

shellHook = ''
Expand Down