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 {
|
mkPoetryApplication {
|
||||||
# name = "text-generation-server";
|
# name = "text-generation-server";
|
||||||
|
|
22
flake.lock
22
flake.lock
|
@ -579,6 +579,27 @@
|
||||||
"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": [
|
||||||
|
@ -880,6 +901,7 @@
|
||||||
"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"
|
||||||
|
|
35
flake.nix
35
flake.nix
|
@ -7,6 +7,10 @@
|
||||||
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";
|
||||||
|
@ -17,6 +21,7 @@
|
||||||
{
|
{
|
||||||
self,
|
self,
|
||||||
crate2nix,
|
crate2nix,
|
||||||
|
naersk,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
flake-utils,
|
flake-utils,
|
||||||
rust-overlay,
|
rust-overlay,
|
||||||
|
@ -41,13 +46,32 @@
|
||||||
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 {
|
text-generation-server = mkPoetryEditablePackage { editablePackageSources = ./server; };
|
||||||
editablePackageSources = ./server;
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
defaultPackage = router;
|
||||||
devShells.default =
|
devShells.default =
|
||||||
with pkgs;
|
with pkgs;
|
||||||
mkShell {
|
mkShell {
|
||||||
|
@ -93,10 +117,7 @@
|
||||||
vllm
|
vllm
|
||||||
|
|
||||||
cargoNix.workspaceMembers.text-generation-launcher.build
|
cargoNix.workspaceMembers.text-generation-launcher.build
|
||||||
|
router
|
||||||
(callPackage ./router.nix {
|
|
||||||
inherit (rustPlatform) buildRustPackage importCargoLock;
|
|
||||||
})
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
venvDir = "./.venv";
|
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