From 947441509580c56e9bd8160bf2cf23c653d19abd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Wed, 21 Aug 2024 07:48:13 +0200 Subject: [PATCH] nix: add `text-generation-benchmark` to pure devshell (#2431) nix: add text-generation-benchmark to pure devshell --- flake.nix | 4 +++ nix/crate-overrides.nix | 68 ++++++++++++++++++++++++++--------------- 2 files changed, 47 insertions(+), 25 deletions(-) diff --git a/flake.nix b/flake.nix index adc70fd1..1c9c77a9 100644 --- a/flake.nix +++ b/flake.nix @@ -43,6 +43,9 @@ ]; }; crateOverrides = import ./nix/crate-overrides.nix { inherit pkgs nix-filter; }; + benchmark = cargoNix.workspaceMembers.text-generation-benchmark.build.override { + inherit crateOverrides; + }; launcher = cargoNix.workspaceMembers.text-generation-launcher.build.override { inherit crateOverrides; }; @@ -57,6 +60,7 @@ pure = mkShell { buildInputs = [ + benchmark launcher router server diff --git a/nix/crate-overrides.nix b/nix/crate-overrides.nix index 343b3b25..cbf366af 100644 --- a/nix/crate-overrides.nix +++ b/nix/crate-overrides.nix @@ -20,34 +20,52 @@ defaultCrateOverrides rav1e = attrs: { env.CARGO_ENCODED_RUSTFLAGS = "-C target-feature=-crt-static"; }; grpc-metadata = attrs: { - src = - filter { - root = ../backends/grpc-metadata; - include = with filter; [ - isDirectory - (matchExt "rs") - ]; - }; + src = filter { + root = ../backends/grpc-metadata; + include = with filter; [ + isDirectory + (matchExt "rs") + ]; + }; }; - text-generation-launcer = attrs: { - src = - filter { - root = ../launcher; - include = with filter; [ - isDirectory - (matchExt "rs") - ]; - }; + text-generation-benchmark = attrs: { + src = filter { + root = ../benchmark; + include = with filter; [ + isDirectory + (matchExt "rs") + ]; + }; + }; + text-generation-client = attrs: { + src = filter { + root = ../.; + include = with filter; [ + isDirectory + (and (inDirectory "backends/client") (matchExt "rs")) + (and (inDirectory "proto") (matchExt "proto")) + ]; + }; + postPatch = "cd backends/client"; + buildInputs = [ protobuf ]; + }; + text-generation-launcher = attrs: { + src = filter { + root = ../launcher; + include = with filter; [ + isDirectory + (matchExt "rs") + ]; + }; }; text-generation-router = attrs: { - src = - filter { - root = ../router; - include = with filter; [ - isDirectory - (matchExt "rs") - ]; - }; + src = filter { + root = ../router; + include = with filter; [ + isDirectory + (matchExt "rs") + ]; + }; }; text-generation-router-v3 = attrs: { # We need to do the src/source root dance so that the build