2024-09-27 08:19:42 -06:00
|
|
|
{
|
2024-10-22 03:02:55 -06:00
|
|
|
lib,
|
2024-09-27 08:19:42 -06:00
|
|
|
mkShell,
|
2024-10-09 03:08:02 -06:00
|
|
|
black,
|
2024-10-22 03:02:55 -06:00
|
|
|
cmake,
|
2024-10-09 03:08:02 -06:00
|
|
|
isort,
|
2024-10-22 03:02:55 -06:00
|
|
|
ninja,
|
|
|
|
which,
|
|
|
|
cudaPackages,
|
2024-09-27 08:19:42 -06:00
|
|
|
openssl,
|
|
|
|
pkg-config,
|
|
|
|
protobuf,
|
|
|
|
python3,
|
|
|
|
pyright,
|
|
|
|
redocly,
|
|
|
|
ruff,
|
|
|
|
rust-bin,
|
|
|
|
server,
|
2024-10-22 03:02:55 -06:00
|
|
|
|
|
|
|
# Enable dependencies for building CUDA packages. Useful for e.g.
|
|
|
|
# developing marlin/moe-kernels in-place.
|
|
|
|
withCuda ? false,
|
2024-09-27 08:19:42 -06:00
|
|
|
}:
|
|
|
|
|
|
|
|
mkShell {
|
2024-10-22 03:02:55 -06:00
|
|
|
nativeBuildInputs =
|
2024-09-27 08:19:42 -06:00
|
|
|
[
|
2024-10-09 03:08:02 -06:00
|
|
|
black
|
|
|
|
isort
|
2024-09-27 08:19:42 -06:00
|
|
|
pkg-config
|
|
|
|
(rust-bin.stable.latest.default.override {
|
|
|
|
extensions = [
|
|
|
|
"rust-analyzer"
|
|
|
|
"rust-src"
|
|
|
|
];
|
|
|
|
})
|
|
|
|
protobuf
|
|
|
|
pyright
|
|
|
|
redocly
|
|
|
|
ruff
|
|
|
|
]
|
2024-10-22 03:02:55 -06:00
|
|
|
++ (lib.optionals withCuda [
|
|
|
|
cmake
|
|
|
|
ninja
|
|
|
|
which
|
|
|
|
|
|
|
|
# For most Torch-based extensions, setting CUDA_HOME is enough, but
|
|
|
|
# some custom CMake builds (e.g. vLLM) also need to have nvcc in PATH.
|
|
|
|
cudaPackages.cuda_nvcc
|
|
|
|
]);
|
|
|
|
buildInputs =
|
|
|
|
[
|
|
|
|
openssl.dev
|
|
|
|
]
|
2024-09-27 08:19:42 -06:00
|
|
|
++ (with python3.pkgs; [
|
|
|
|
venvShellHook
|
|
|
|
docker
|
|
|
|
pip
|
|
|
|
ipdb
|
|
|
|
click
|
|
|
|
pytest
|
|
|
|
pytest-asyncio
|
|
|
|
syrupy
|
2024-10-22 03:02:55 -06:00
|
|
|
])
|
|
|
|
++ (lib.optionals withCuda (
|
|
|
|
with cudaPackages;
|
|
|
|
[
|
|
|
|
cuda_cccl
|
|
|
|
cuda_cudart
|
2024-10-23 04:04:05 -06:00
|
|
|
cuda_nvrtc
|
2024-10-22 03:02:55 -06:00
|
|
|
cuda_nvtx
|
2024-10-23 04:04:05 -06:00
|
|
|
cuda_profiler_api
|
2024-10-22 03:02:55 -06:00
|
|
|
cudnn
|
|
|
|
libcublas
|
|
|
|
libcusolver
|
|
|
|
libcusparse
|
|
|
|
]
|
|
|
|
));
|
2024-09-27 08:19:42 -06:00
|
|
|
|
|
|
|
inputsFrom = [ server ];
|
|
|
|
|
2024-10-22 03:02:55 -06:00
|
|
|
env = lib.optionalAttrs withCuda {
|
|
|
|
CUDA_HOME = "${lib.getDev cudaPackages.cuda_nvcc}";
|
|
|
|
TORCH_CUDA_ARCH_LIST = lib.concatStringsSep ";" python3.pkgs.torch.cudaCapabilities;
|
|
|
|
};
|
|
|
|
|
2024-09-27 08:19:42 -06:00
|
|
|
venvDir = "./.venv";
|
|
|
|
|
|
|
|
postVenvCreation = ''
|
|
|
|
unset SOURCE_DATE_EPOCH
|
|
|
|
( cd server ; python -m pip install --no-dependencies -e . )
|
|
|
|
( cd clients/python ; python -m pip install --no-dependencies -e . )
|
|
|
|
'';
|
2024-10-22 03:02:55 -06:00
|
|
|
|
2024-09-27 08:19:42 -06:00
|
|
|
postShellHook = ''
|
|
|
|
unset SOURCE_DATE_EPOCH
|
|
|
|
export PATH=$PATH:~/.cargo/bin
|
|
|
|
'';
|
|
|
|
}
|