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
This commit is contained in:
1 parent
1acb040494
commit
f566a6b1e0
1 file changed
+9
-5
@@ -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
|
||||
|
||||
Reference in new issue
Block a user