Skip to content

Commit 62986a2

Browse files
committed
use cargo cache in devshell too
1 parent 1dec545 commit 62986a2

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

flake.nix

+11-2
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,18 @@
4646
if pkgs.stdenv.isLinux then pkgs.stdenv
4747
else if pkgs.stdenv.isDarwin then pkgs.clang18Stdenv
4848
else throw "Unsupported platform";
49+
4950
cargoDeps = pkgs.rustPlatform.importCargoLock {
5051
lockFile = ./src/jit/Cargo.lock;
5152
};
53+
54+
cargoConfigFile = pkgs.writeText "cargo-config.toml" ''
55+
[source.crates-io]
56+
replace-with = "vendored-sources"
57+
58+
[source.vendored-sources]
59+
directory = "${cargoDeps}"
60+
'';
5261
in
5362
{
5463
packages.default = stdenv.mkDerivation
@@ -91,8 +100,8 @@
91100
{
92101
buildInputs = devShellTools ++ tools ++ libs;
93102
shellHook = ''
94-
# So the cargo dependencies get cached offline, just in case
95-
export cargoDeps=${cargoDeps}
103+
mkdir -p ./src/jit/.cargo
104+
ln -s ${cargoConfigFile} ./src/jit/.cargo/config.toml
96105
'' + (if stdenv.isLinux then ''
97106
export LD_LIBRARY_PATH="${pkgs.vulkan-loader}/lib";
98107
'' else if stdenv.isDarwin then ''

src/jit/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
target
2+
.cargo

0 commit comments

Comments
 (0)