From 5289bea46e32fdb247a9a9ef495f763240bd762e Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Fri, 6 Mar 2026 11:53:14 +0100 Subject: [PATCH] nix: Coerce rel path to cargo wrapper script into abs path (#50919) This allows you to now re-use our Zed flake in different side projects with cargo wrapper script having its path correctly resolved. Say you have this dir structure: ``` $HOME/dev/zed $HOME/dev/something ``` Then this now works: ``` $ cd $HOME/dev/something $ nix develop ../zed $ cargo version cargo 1.93.0 (083ac5135 2025-12-15) ``` Release Notes: - N/A --- nix/modules/devshells.nix | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/nix/modules/devshells.nix b/nix/modules/devshells.nix index cfc0e48b871e71d87f9f794b35c16fed714ed4a9..ab58d37fff2dcaa64885effa5526db7bd365586b 100644 --- a/nix/modules/devshells.nix +++ b/nix/modules/devshells.nix @@ -22,10 +22,14 @@ # Cargo build timings wrapper script wrappedCargo = pkgs.writeShellApplication { name = "cargo"; - runtimeInputs = [pkgs.nodejs]; - text = '' - NIX_WRAPPER=1 CARGO=${rustToolchain}/bin/cargo ./script/cargo "$@" - ''; + runtimeInputs = [ pkgs.nodejs ]; + text = + let + pathToCargoScript = ./. + "/../../script/cargo"; + in + '' + NIX_WRAPPER=1 CARGO=${rustToolchain}/bin/cargo ${pathToCargoScript} "$@" + ''; }; in { @@ -34,7 +38,7 @@ inputsFrom = [ zed-editor ]; packages = with pkgs; [ - wrappedCargo # must be first, to shadow the `cargo` provided by `rustToolchain` + wrappedCargo # must be first, to shadow the `cargo` provided by `rustToolchain` rustToolchain # cargo, rustc, and rust-toolchain.toml components included cargo-nextest cargo-hakari