dev: Simplify devShells, restore the -extra devShell
This commit is contained in:
parent
cd8da29059
commit
06a8547a20
3 changed files with 63 additions and 40 deletions
|
@ -1,14 +1,48 @@
|
||||||
|
{ inputs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
perSystem =
|
perSystem =
|
||||||
{ config, lib, ... }:
|
|
||||||
{
|
{
|
||||||
devShells = lib.pipe (config.packages) [
|
config,
|
||||||
(lib.concatMapAttrs
|
lib,
|
||||||
(name: package: {
|
system,
|
||||||
${name} = package.passthru.shell or null;
|
...
|
||||||
}))
|
}:
|
||||||
(lib.filterAttrs (name: value: value != null))
|
{
|
||||||
];
|
devShells =
|
||||||
|
let
|
||||||
|
pkgs = import inputs.nixpkgs { inherit system; };
|
||||||
|
stdenv = pkgs.stdenv;
|
||||||
|
scripts = config.packages.python-scripts;
|
||||||
|
in
|
||||||
|
lib.pipe (config.packages) [
|
||||||
|
(lib.concatMapAttrs (
|
||||||
|
name: package: {
|
||||||
|
${name} = pkgs.mkShell {
|
||||||
|
name = "${name}";
|
||||||
|
inputsFrom = [ package ];
|
||||||
|
shellHook = ''
|
||||||
|
echo "Entering ${name} devShell"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
"${name}-extra" =
|
||||||
|
if (name == "python-scripts") then
|
||||||
|
null
|
||||||
|
else
|
||||||
|
pkgs.mkShell {
|
||||||
|
name = "${name}-extra";
|
||||||
|
inputsFrom = [
|
||||||
|
package
|
||||||
|
scripts
|
||||||
|
];
|
||||||
|
shellHook = ''
|
||||||
|
echo "Entering ${name} devShell"
|
||||||
|
addToSearchPath "LD_LIBRARY_PATH" "${lib.getLib stdenv.cc.cc}/lib"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
))
|
||||||
|
(lib.filterAttrs (name: value: value != null))
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -215,25 +215,6 @@ effectiveStdenv.mkDerivation (finalAttrs: {
|
||||||
cp $src/include/llama.h $out/include/
|
cp $src/include/llama.h $out/include/
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Define the shells here, but don't add in the inputsFrom to avoid recursion.
|
|
||||||
passthru = {
|
|
||||||
inherit
|
|
||||||
useBlas
|
|
||||||
useCuda
|
|
||||||
useMetalKit
|
|
||||||
useMpi
|
|
||||||
useRocm
|
|
||||||
useVulkan
|
|
||||||
;
|
|
||||||
|
|
||||||
shell = mkShell {
|
|
||||||
name = "shell-${finalAttrs.finalPackage.name}";
|
|
||||||
description = "contains numpy and sentencepiece";
|
|
||||||
nativeBuildInputs = [ cmake ];
|
|
||||||
inputsFrom = [ finalAttrs.finalPackage ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
# Configurations we don't want even the CI to evaluate. Results in the
|
# Configurations we don't want even the CI to evaluate. Results in the
|
||||||
# "unsupported platform" messages. This is mostly a no-op, because
|
# "unsupported platform" messages. This is mostly a no-op, because
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
stdenv,
|
stdenv,
|
||||||
buildPythonPackage,
|
buildPythonPackage,
|
||||||
poetry-core,
|
poetry-core,
|
||||||
breakpointHook,
|
|
||||||
mkShell,
|
mkShell,
|
||||||
python3Packages,
|
python3Packages,
|
||||||
gguf-py,
|
gguf-py,
|
||||||
|
@ -18,6 +17,25 @@ let
|
||||||
torchWithoutCuda
|
torchWithoutCuda
|
||||||
gguf-py
|
gguf-py
|
||||||
tqdm
|
tqdm
|
||||||
|
|
||||||
|
# for scripts/compare-llama-bench.py
|
||||||
|
gitpython
|
||||||
|
tabulate
|
||||||
|
|
||||||
|
# for examples/pydantic-models-to-grammar-examples.py
|
||||||
|
docstring-parser
|
||||||
|
pydantic
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
llama-python-test-deps = with python3Packages; [
|
||||||
|
# Server bench
|
||||||
|
matplotlib
|
||||||
|
|
||||||
|
# server tests
|
||||||
|
openai
|
||||||
|
behave
|
||||||
|
prometheus-client
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
|
|
||||||
|
@ -43,16 +61,6 @@ buildPythonPackage ({
|
||||||
src = lib.cleanSource ../../.;
|
src = lib.cleanSource ../../.;
|
||||||
};
|
};
|
||||||
nativeBuildInputs = [ poetry-core ];
|
nativeBuildInputs = [ poetry-core ];
|
||||||
|
nativeCheckInputs = llama-python-test-deps;
|
||||||
dependencies = llama-python-deps;
|
dependencies = llama-python-deps;
|
||||||
|
|
||||||
passthru = {
|
|
||||||
shell = mkShell {
|
|
||||||
name = "shell-python-scripts";
|
|
||||||
description = "contains numpy and sentencepiece";
|
|
||||||
buildInputs = llama-python-deps;
|
|
||||||
shellHook = ''
|
|
||||||
addToSearchPath "LD_LIBRARY_PATH" "${lib.getLib stdenv.cc.cc}/lib"
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue