llama-cpp: build webui from source (#484467)

This commit is contained in:
Philip Taron
2026-01-27 19:13:17 +00:00
committed by GitHub
+26
View File
@@ -27,6 +27,10 @@
],
blas,
fetchNpmDeps,
nodejs,
npmHooks,
pkg-config,
metalSupport ? stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 && !openclSupport,
vulkanSupport ? false,
@@ -88,10 +92,18 @@ effectiveStdenv.mkDerivation (finalAttrs: {
'';
};
patches = [ ];
postPatch = ''
rm tools/server/public/index.html.gz
'';
nativeBuildInputs = [
cmake
installShellFiles
ninja
nodejs
npmHooks.npmConfigHook
pkg-config
]
++ optionals cudaSupport [
@@ -107,8 +119,22 @@ effectiveStdenv.mkDerivation (finalAttrs: {
++ optionals vulkanSupport vulkanBuildInputs
++ [ openssl ];
npmRoot = "tools/server/webui";
npmDepsHash = "sha256-m1boNqwMELdpHbV/jYK3hpf2vP1S/KSAf32wVKQGyFo=";
npmDeps = fetchNpmDeps {
name = "${finalAttrs.pname}-${finalAttrs.version}-npm-deps";
inherit (finalAttrs) src patches;
preBuild = ''
pushd ${finalAttrs.npmRoot}
'';
hash = finalAttrs.npmDepsHash;
};
preConfigure = ''
prependToVar cmakeFlags "-DLLAMA_BUILD_COMMIT:STRING=$(cat COMMIT)"
pushd ${finalAttrs.npmRoot}
npm run build
popd
'';
cmakeFlags = [