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

feat(rust): set $CARGO_INSTALL_ROOT and $PATH used in cargo install #721

Merged
merged 5 commits into from
Aug 27, 2023
Merged
Changes from 1 commit
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
13 changes: 13 additions & 0 deletions src/modules/languages/rust.nix
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,19 @@ in

config = lib.mkMerge [
(lib.mkIf cfg.enable {

# Set $CARGO_INSTALL_ROOT so that executables installed by `cargo install` can be found from $PATH
enterShell = ''
export CARGO_INSTALL_ROOT=$(${
lib.strings.escapeShellArgs [
"${pkgs.coreutils}/bin/realpath"
Atry marked this conversation as resolved.
Show resolved Hide resolved
"--no-symlinks"
"${config.devenv.state}/cargo-install"
Atry marked this conversation as resolved.
Show resolved Hide resolved
]
})
export PATH="$PATH:$CARGO_INSTALL_ROOT/bin"
'';

packages = (builtins.map (c: cfg.toolchain.${c} or (throw (error "toolchain.${c}"))) cfg.components)
++ lib.optional pkgs.stdenv.isDarwin pkgs.libiconv;

Expand Down