Skip to content

Commit 16798d2

Browse files
timon-schellingFirestar99
authored andcommitted
nix: override Path for rust gpu
1 parent 55d1899 commit 16798d2

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

.nix/flake.nix

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,7 @@
6060
cargoBuildFlags = [ "-p" "rustc_codegen_spirv" "--features=use-installed-tools" "--no-default-features" ];
6161
doCheck = false;
6262
});
63-
64-
# Wrapper script for running rust commands with the rust toolchain used by rust-gpu.
65-
# For example `rust-gpu cargo --version` or `rust-gpu rustc --version`.
66-
execWithRustGPUEnvironment = pkgs.writeShellScriptBin "rust-gpu" ''
63+
rustGpuCargo = pkgs.writeShellScriptBin "cargo" ''
6764
#!${pkgs.lib.getExe pkgs.bash}
6865
6966
filtered_args=()
@@ -74,11 +71,9 @@
7471
esac
7572
done
7673
77-
export PATH="${pkgs.lib.makeBinPath [ rustGPUToolchainPkg pkgs.spirv-tools ]}:$PATH"
78-
export RUSTC_CODEGEN_SPIRV_PATH="${rustc_codegen_spirv}/lib/librustc_codegen_spirv.so"
79-
80-
exec ${"\${filtered_args[@]}"}
74+
exec ${rustGPUToolchainPkg}/bin/cargo ${"\${filtered_args[@]}"}
8175
'';
76+
rustGpuPathOverride = "${rustGpuCargo}/bin:${rustGPUToolchainPkg}/bin:${pkgs.spirv-tools}/bin";
8277

8378
libcef = pkgs.libcef.overrideAttrs (finalAttrs: previousAttrs: {
8479
version = "139.0.17";
@@ -137,8 +132,6 @@
137132

138133
# Linker
139134
pkgs.mold
140-
141-
execWithRustGPUEnvironment
142135
];
143136
# Development tools that don't need to be in LD_LIBRARY_PATH
144137
devTools = with pkgs; [
@@ -150,6 +143,9 @@
150143
gnuplot
151144
samply
152145
cargo-flamegraph
146+
147+
# Useful for rust-gpu debugging
148+
pkgs.spirv-tools
153149
];
154150
in
155151
{
@@ -161,6 +157,9 @@
161157
CEF_PATH = libcefPath;
162158
XDG_DATA_DIRS="${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}:$XDG_DATA_DIRS";
163159

160+
RUST_GPU_PATH_OVERRIDE = rustGpuPathOverride;
161+
RUSTC_CODEGEN_SPIRV_PATH = "${rustc_codegen_spirv}/lib/librustc_codegen_spirv.so";
162+
164163
shellHook = ''
165164
alias cargo='mold --run cargo'
166165
'';

0 commit comments

Comments
 (0)