Skip to content

Commit

Permalink
Set $CARGO_INSTALL_ROOT and $PATH used in cargo install
Browse files Browse the repository at this point in the history
  • Loading branch information
Atry committed Jul 20, 2023
1 parent 36a7bb5 commit 9d2d516
Showing 1 changed file with 13 additions and 0 deletions.
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"
"--no-symlinks"
"${config.devenv.state}/cargo-install"
]
})
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

0 comments on commit 9d2d516

Please sign in to comment.