Skip to content

nix: add nix-nodejs facilities to build Web UI#23846

Merged
aldehir merged 2 commits into
ggml-org:masterfrom
choener:choener/23067-fix-webui
Jun 1, 2026
Merged

nix: add nix-nodejs facilities to build Web UI#23846
aldehir merged 2 commits into
ggml-org:masterfrom
choener:choener/23067-fix-webui

Conversation

@choener

@choener choener commented May 29, 2026

Copy link
Copy Markdown
Contributor

Overview

Build the Web UI locally using standard Nix systems for building NodeJS packages.

  • Create derivation for the web UI
  • npm dependencies are imported via buildNodeModules. Does not require setting any shasum.
  • Copy build artifacts to the correct folders.
  • Prevents having to download from huggingface.co

Fixes #23067

Additional information

  • I use this PR with my NixOS machines, running the webui as well.
  • I have only tested the vulkan build (which should not matter for a nix patch).

Requirements

Build the Web UI locally using standard Nix systems for building NodeJS
packages.

- Create derivation for the web UI
- npm dependencies are imported via buildNodeModules. Does not require
  setting any shasum.
- Copy build artifacts to the correct folders.
- Prevents having to download from huggingface.co

Fixes ggml-org#23067
@github-actions github-actions Bot added nix Issues specific to consuming flake.nix, or generally concerned with ❄ Nix-based llama.cpp deployment devops improvements to build systems and github actions labels May 29, 2026
@aldehir

aldehir commented May 29, 2026

Copy link
Copy Markdown
Contributor

Thanks for the PR.

I believe you can simplify some of this by using the LLAMA_UI_OUT_DIR env var during npm build.

Also, be sure to copy the files to tools/ui/dist relative to the source tree so it does not attempt an npm build at all.

@choener

choener commented May 29, 2026

Copy link
Copy Markdown
Contributor Author

Thanks,
I'll update the PR tonight based on your suggestions.

- Move npm build to installPhase with LLAMA_UI_OUT_DIR=$out to write
  output directly to the Nix store
- Copy built assets to tools/ui/dist (source tree) instead of
  build/tools/ui/dist so CMake's copy_src_dist() finds them
@choener

choener commented May 31, 2026

Copy link
Copy Markdown
Contributor Author

@aldehir the 2nd commit contains the requested changes for review.

@aldehir

aldehir commented May 31, 2026

Copy link
Copy Markdown
Contributor

@choener perfect! Thank you for the PR, I don't think any of the active maintainers use the nix build.

@choener

choener commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

Thank you!
Btw. I am using both Nix, and the llama.cpp master. I'll likely provide a PR if anything should break again.

@aldehir aldehir merged commit 5aa3a64 into ggml-org:master Jun 1, 2026
3 checks passed
jimbothigpen pushed a commit to jimbothigpen/llama.cpp that referenced this pull request Jun 6, 2026
* nix: add nix-nodejs facilities to build Web UI

Build the Web UI locally using standard Nix systems for building NodeJS
packages.

- Create derivation for the web UI
- npm dependencies are imported via buildNodeModules. Does not require
  setting any shasum.
- Copy build artifacts to the correct folders.
- Prevents having to download from huggingface.co

Fixes ggml-org#23067

* nix: simplify webui derivation using LLAMA_UI_OUT_DIR

- Move npm build to installPhase with LLAMA_UI_OUT_DIR=$out to write
  output directly to the Nix store
- Copy built assets to tools/ui/dist (source tree) instead of
  build/tools/ui/dist so CMake's copy_src_dist() finds them

(cherry picked from commit 5aa3a64)
zbrad pushed a commit to zbrad/llama.cpp that referenced this pull request Jul 3, 2026
* nix: add nix-nodejs facilities to build Web UI

Build the Web UI locally using standard Nix systems for building NodeJS
packages.

- Create derivation for the web UI
- npm dependencies are imported via buildNodeModules. Does not require
  setting any shasum.
- Copy build artifacts to the correct folders.
- Prevents having to download from huggingface.co

Fixes ggml-org#23067

* nix: simplify webui derivation using LLAMA_UI_OUT_DIR

- Move npm build to installPhase with LLAMA_UI_OUT_DIR=$out to write
  output directly to the Nix store
- Copy built assets to tools/ui/dist (source tree) instead of
  build/tools/ui/dist so CMake's copy_src_dist() finds them
adrianhoehne pushed a commit to adrianhoehne/llama.cpp that referenced this pull request Jul 5, 2026
* nix: add nix-nodejs facilities to build Web UI

Build the Web UI locally using standard Nix systems for building NodeJS
packages.

- Create derivation for the web UI
- npm dependencies are imported via buildNodeModules. Does not require
  setting any shasum.
- Copy build artifacts to the correct folders.
- Prevents having to download from huggingface.co

Fixes ggml-org#23067

* nix: simplify webui derivation using LLAMA_UI_OUT_DIR

- Move npm build to installPhase with LLAMA_UI_OUT_DIR=$out to write
  output directly to the Nix store
- Copy built assets to tools/ui/dist (source tree) instead of
  build/tools/ui/dist so CMake's copy_src_dist() finds them
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devops improvements to build systems and github actions nix Issues specific to consuming flake.nix, or generally concerned with ❄ Nix-based llama.cpp deployment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compile bug: Nix flake fails to build llama-server

3 participants