nix: partial incremental build of the router (#2416)
This is less incremental than crate2nix, but does build all dependencies separately, so avoids full rebuilds.
This commit is contained in:
parent
1cebccc72b
commit
c5fff92b48
|
@ -1,4 +1,9 @@
|
|||
{ mkPoetryApplication, pkg-config, protobuf, openssl }:
|
||||
{
|
||||
mkPoetryApplication,
|
||||
pkg-config,
|
||||
protobuf,
|
||||
openssl,
|
||||
}:
|
||||
|
||||
mkPoetryApplication {
|
||||
# name = "text-generation-server";
|
||||
|
|
22
flake.lock
22
flake.lock
|
@ -579,6 +579,27 @@
|
|||
"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": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
@ -880,6 +901,7 @@
|
|||
"inputs": {
|
||||
"crate2nix": "crate2nix",
|
||||
"flake-utils": "flake-utils_6",
|
||||
"naersk": "naersk",
|
||||
"nixpkgs": [
|
||||
"tgi-nix",
|
||||
"nixpkgs"
|
||||
|
|
37
flake.nix
37
flake.nix
|
@ -7,6 +7,10 @@
|
|||
tgi-nix.url = "github:danieldk/tgi-nix";
|
||||
nixpkgs.follows = "tgi-nix/nixpkgs";
|
||||
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";
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
|
@ -17,6 +21,7 @@
|
|||
{
|
||||
self,
|
||||
crate2nix,
|
||||
naersk,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
rust-overlay,
|
||||
|
@ -41,13 +46,32 @@
|
|||
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;
|
||||
text-generation-server = mkPoetryEditablePackage {
|
||||
editablePackageSources = ./server;
|
||||
};
|
||||
text-generation-server = mkPoetryEditablePackage { editablePackageSources = ./server; };
|
||||
in
|
||||
{
|
||||
defaultPackage = router;
|
||||
devShells.default =
|
||||
with pkgs;
|
||||
mkShell {
|
||||
|
@ -92,11 +116,8 @@
|
|||
transformers
|
||||
vllm
|
||||
|
||||
cargoNix.workspaceMembers.text-generation-launcher.build
|
||||
|
||||
(callPackage ./router.nix {
|
||||
inherit (rustPlatform) buildRustPackage importCargoLock;
|
||||
})
|
||||
cargoNix.workspaceMembers.text-generation-launcher.build
|
||||
router
|
||||
]);
|
||||
|
||||
venvDir = "./.venv";
|
||||
|
|
18
router.nix
18
router.nix
|
@ -1,18 +0,0 @@
|
|||
{ buildRustPackage, importCargoLock, pkg-config, protobuf, openssl }:
|
||||
|
||||
buildRustPackage {
|
||||
name = "text-generation-router";
|
||||
|
||||
src = ./.;
|
||||
|
||||
sourceDir = ./backends/v3;
|
||||
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ pkg-config ];
|
||||
|
||||
buildInputs = [ openssl.dev protobuf ];
|
||||
|
||||
}
|
Loading…
Reference in New Issue