nix: build router incrementally (#2422)
This commit is contained in:
parent
3f385991b0
commit
9aaa12e7ac
22
flake.lock
22
flake.lock
|
@ -579,27 +579,6 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"naersk": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"tgi-nix",
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1721727458,
|
|
||||||
"narHash": "sha256-r/xppY958gmZ4oTfLiHN0ZGuQ+RSTijDblVgVLFi1mw=",
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "naersk",
|
|
||||||
"rev": "3fb418eaf352498f6b6c30592e3beb63df42ef11",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "naersk",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nix-github-actions": {
|
"nix-github-actions": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
@ -901,7 +880,6 @@
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"crate2nix": "crate2nix",
|
"crate2nix": "crate2nix",
|
||||||
"flake-utils": "flake-utils_6",
|
"flake-utils": "flake-utils_6",
|
||||||
"naersk": "naersk",
|
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"tgi-nix",
|
"tgi-nix",
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
|
|
53
flake.nix
53
flake.nix
|
@ -7,10 +7,6 @@
|
||||||
tgi-nix.url = "github:danieldk/tgi-nix";
|
tgi-nix.url = "github:danieldk/tgi-nix";
|
||||||
nixpkgs.follows = "tgi-nix/nixpkgs";
|
nixpkgs.follows = "tgi-nix/nixpkgs";
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
naersk = {
|
|
||||||
url = "github:nix-community/naersk";
|
|
||||||
inputs.nixpkgs.follows = "tgi-nix/nixpkgs";
|
|
||||||
};
|
|
||||||
poetry2nix.url = "github:nix-community/poetry2nix";
|
poetry2nix.url = "github:nix-community/poetry2nix";
|
||||||
rust-overlay = {
|
rust-overlay = {
|
||||||
url = "github:oxalica/rust-overlay";
|
url = "github:oxalica/rust-overlay";
|
||||||
|
@ -21,7 +17,6 @@
|
||||||
{
|
{
|
||||||
self,
|
self,
|
||||||
crate2nix,
|
crate2nix,
|
||||||
naersk,
|
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
flake-utils,
|
flake-utils,
|
||||||
rust-overlay,
|
rust-overlay,
|
||||||
|
@ -34,6 +29,7 @@
|
||||||
cargoNix = crate2nix.tools.${system}.appliedCargoNix {
|
cargoNix = crate2nix.tools.${system}.appliedCargoNix {
|
||||||
name = "tgi";
|
name = "tgi";
|
||||||
src = ./.;
|
src = ./.;
|
||||||
|
additionalCargoNixArgs = [ "--all-features" ];
|
||||||
};
|
};
|
||||||
config = {
|
config = {
|
||||||
allowUnfree = true;
|
allowUnfree = true;
|
||||||
|
@ -46,32 +42,10 @@
|
||||||
tgi-nix.overlay
|
tgi-nix.overlay
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
naersk' = pkgs.callPackage naersk { };
|
|
||||||
router =
|
|
||||||
with pkgs;
|
|
||||||
naersk'.buildPackage {
|
|
||||||
name = "router";
|
|
||||||
src = ./.;
|
|
||||||
cargoBuildOptions =
|
|
||||||
x:
|
|
||||||
x
|
|
||||||
++ [
|
|
||||||
"-p"
|
|
||||||
"text-generation-router-v3"
|
|
||||||
];
|
|
||||||
nativeBuildInputs = [ pkg-config ];
|
|
||||||
buildInputs = [
|
|
||||||
openssl.dev
|
|
||||||
protobuf
|
|
||||||
];
|
|
||||||
doCheck = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryEditablePackage;
|
inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryEditablePackage;
|
||||||
text-generation-server = mkPoetryEditablePackage { editablePackageSources = ./server; };
|
text-generation-server = mkPoetryEditablePackage { editablePackageSources = ./server; };
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
defaultPackage = router;
|
|
||||||
devShells.default =
|
devShells.default =
|
||||||
with pkgs;
|
with pkgs;
|
||||||
mkShell {
|
mkShell {
|
||||||
|
@ -118,7 +92,30 @@
|
||||||
vllm
|
vllm
|
||||||
|
|
||||||
cargoNix.workspaceMembers.text-generation-launcher.build
|
cargoNix.workspaceMembers.text-generation-launcher.build
|
||||||
router
|
|
||||||
|
(cargoNix.workspaceMembers.text-generation-router-v3.build.override {
|
||||||
|
crateOverrides = defaultCrateOverrides // {
|
||||||
|
aws-lc-rs = attrs: {
|
||||||
|
# aws-lc-rs does its own custom parsing of Cargo environment
|
||||||
|
# variables like DEP_.*_INCLUDE. However buildRustCrate does
|
||||||
|
# not use the version number, so the parsing fails.
|
||||||
|
postPatch = ''
|
||||||
|
substituteInPlace build.rs \
|
||||||
|
--replace-fail \
|
||||||
|
"assert!(!selected.is_empty()" \
|
||||||
|
"// assert!(!selected.is_empty()"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
rav1e = attrs: { env.CARGO_ENCODED_RUSTFLAGS = "-C target-feature=-crt-static"; };
|
||||||
|
text-generation-router-v3 = attrs: {
|
||||||
|
# We need to do the src/source root dance so that the build
|
||||||
|
# has access to the protobuf file.
|
||||||
|
src = ./.;
|
||||||
|
postPatch = "cd backends/v3";
|
||||||
|
buildInputs = [ protobuf ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
]);
|
]);
|
||||||
|
|
||||||
venvDir = "./.venv";
|
venvDir = "./.venv";
|
||||||
|
|
Loading…
Reference in New Issue