2024-08-09 04:32:37 -06:00
|
|
|
{
|
|
|
|
inputs = {
|
2024-08-13 02:44:15 -06:00
|
|
|
crate2nix = {
|
|
|
|
url = "github:nix-community/crate2nix";
|
|
|
|
inputs.nixpkgs.follows = "tgi-nix/nixpkgs";
|
|
|
|
};
|
2024-08-16 02:01:01 -06:00
|
|
|
nix-filter.url = "github:numtide/nix-filter";
|
2024-08-09 04:32:37 -06:00
|
|
|
tgi-nix.url = "github:danieldk/tgi-nix";
|
|
|
|
nixpkgs.follows = "tgi-nix/nixpkgs";
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
2024-08-09 07:24:21 -06:00
|
|
|
rust-overlay = {
|
|
|
|
url = "github:oxalica/rust-overlay";
|
|
|
|
inputs.nixpkgs.follows = "tgi-nix/nixpkgs";
|
|
|
|
};
|
2024-08-09 04:32:37 -06:00
|
|
|
};
|
|
|
|
outputs =
|
|
|
|
{
|
|
|
|
self,
|
2024-08-13 02:44:15 -06:00
|
|
|
crate2nix,
|
2024-08-16 02:01:01 -06:00
|
|
|
nix-filter,
|
2024-08-09 04:32:37 -06:00
|
|
|
nixpkgs,
|
|
|
|
flake-utils,
|
2024-08-09 07:24:21 -06:00
|
|
|
rust-overlay,
|
2024-08-09 04:32:37 -06:00
|
|
|
tgi-nix,
|
|
|
|
}:
|
|
|
|
flake-utils.lib.eachDefaultSystem (
|
|
|
|
system:
|
|
|
|
let
|
2024-08-13 02:44:15 -06:00
|
|
|
cargoNix = crate2nix.tools.${system}.appliedCargoNix {
|
|
|
|
name = "tgi";
|
|
|
|
src = ./.;
|
2024-08-15 02:21:51 -06:00
|
|
|
additionalCargoNixArgs = [ "--all-features" ];
|
2024-08-13 02:44:15 -06:00
|
|
|
};
|
2024-08-09 04:32:37 -06:00
|
|
|
config = {
|
|
|
|
allowUnfree = true;
|
|
|
|
cudaSupport = true;
|
|
|
|
};
|
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit config system;
|
2024-08-09 07:24:21 -06:00
|
|
|
overlays = [
|
|
|
|
rust-overlay.overlays.default
|
|
|
|
tgi-nix.overlay
|
|
|
|
];
|
2024-08-09 04:32:37 -06:00
|
|
|
};
|
2024-08-16 02:01:01 -06:00
|
|
|
crateOverrides = import ./nix/crate-overrides.nix { inherit pkgs nix-filter; };
|
2024-08-20 23:48:13 -06:00
|
|
|
benchmark = cargoNix.workspaceMembers.text-generation-benchmark.build.override {
|
|
|
|
inherit crateOverrides;
|
|
|
|
};
|
2024-08-20 14:07:33 -06:00
|
|
|
launcher = cargoNix.workspaceMembers.text-generation-launcher.build.override {
|
|
|
|
inherit crateOverrides;
|
|
|
|
};
|
|
|
|
router = cargoNix.workspaceMembers.text-generation-router-v3.build.override {
|
|
|
|
inherit crateOverrides;
|
|
|
|
};
|
|
|
|
server = pkgs.python3.pkgs.callPackage ./nix/server.nix { inherit nix-filter; };
|
2024-08-09 04:32:37 -06:00
|
|
|
in
|
|
|
|
{
|
2024-08-20 14:07:33 -06:00
|
|
|
devShells = with pkgs; rec {
|
|
|
|
default = pure;
|
|
|
|
|
|
|
|
pure = mkShell {
|
|
|
|
buildInputs = [
|
2024-08-20 23:48:13 -06:00
|
|
|
benchmark
|
2024-08-20 14:07:33 -06:00
|
|
|
launcher
|
|
|
|
router
|
|
|
|
server
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
impure = mkShell {
|
2024-08-09 04:32:37 -06:00
|
|
|
buildInputs =
|
|
|
|
[
|
|
|
|
openssl.dev
|
|
|
|
pkg-config
|
2024-08-09 07:24:21 -06:00
|
|
|
(rust-bin.stable.latest.default.override {
|
|
|
|
extensions = [
|
|
|
|
"rust-analyzer"
|
|
|
|
"rust-src"
|
|
|
|
];
|
|
|
|
})
|
2024-08-20 14:07:33 -06:00
|
|
|
protobuf
|
2024-08-09 04:32:37 -06:00
|
|
|
]
|
|
|
|
++ (with python3.pkgs; [
|
|
|
|
venvShellHook
|
|
|
|
pip
|
2024-08-20 03:15:30 -06:00
|
|
|
ipdb
|
2024-08-09 04:32:37 -06:00
|
|
|
]);
|
|
|
|
|
2024-08-20 14:07:33 -06:00
|
|
|
inputsFrom = [ server ];
|
|
|
|
|
2024-08-09 04:32:37 -06:00
|
|
|
venvDir = "./.venv";
|
|
|
|
|
|
|
|
postVenv = ''
|
|
|
|
unset SOURCE_DATE_EPOCH
|
|
|
|
'';
|
|
|
|
postShellHook = ''
|
|
|
|
unset SOURCE_DATE_EPOCH
|
2024-08-20 14:07:33 -06:00
|
|
|
export PATH=$PATH:~/.cargo/bin
|
2024-08-09 04:32:37 -06:00
|
|
|
'';
|
|
|
|
};
|
2024-08-20 14:07:33 -06:00
|
|
|
};
|
2024-08-09 04:32:37 -06:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|