fix: nvidia driver & llama cpp update
This commit is contained in:
@@ -16,6 +16,12 @@ in
|
|||||||
enable32Bit = mkBoolOpt false "enable 32-bit";
|
enable32Bit = mkBoolOpt false "enable 32-bit";
|
||||||
enableIntel = mkBoolOpt false "support for intel";
|
enableIntel = mkBoolOpt false "support for intel";
|
||||||
enableNvidia = mkBoolOpt false "support for nvidia";
|
enableNvidia = mkBoolOpt false "support for nvidia";
|
||||||
|
nvidiaPackage = lib.mkOption {
|
||||||
|
type = lib.types.package;
|
||||||
|
default = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||||
|
defaultText = "config.boot.kernelPackages.nvidiaPackages.stable";
|
||||||
|
description = "nvidia driver package; pin to legacy_580 for Pascal (GTX 10xx) and older";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
@@ -32,7 +38,7 @@ in
|
|||||||
|
|
||||||
# Enable Nvidia Hardware
|
# Enable Nvidia Hardware
|
||||||
hardware.nvidia = mkIf cfg.enableNvidia {
|
hardware.nvidia = mkIf cfg.enableNvidia {
|
||||||
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
package = cfg.nvidiaPackage;
|
||||||
modesetting.enable = true;
|
modesetting.enable = true;
|
||||||
powerManagement.enable = true;
|
powerManagement.enable = true;
|
||||||
open = false;
|
open = false;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ inputs, ... }:
|
{ inputs, ... }:
|
||||||
final: _prev: {
|
final: _prev: {
|
||||||
firefox-addons = inputs.firefox-addons.packages.${final.system};
|
firefox-addons = inputs.firefox-addons.packages.${final.stdenv.hostPlatform.system};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,63 +3,19 @@ let
|
|||||||
# Version MUST be an integer string.
|
# Version MUST be an integer string.
|
||||||
# For tagged releases use the tag number (e.g. "9222").
|
# For tagged releases use the tag number (e.g. "9222").
|
||||||
# For HEAD builds use YYYYMMDD (e.g. "20260519").
|
# For HEAD builds use YYYYMMDD (e.g. "20260519").
|
||||||
version = "9412";
|
version = "9496";
|
||||||
|
|
||||||
src = pkgs.fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
owner = "ggml-org";
|
owner = "ggml-org";
|
||||||
repo = "llama.cpp";
|
repo = "llama.cpp";
|
||||||
rev = "cb47092b007fcd5122eee2e8bb32ce972cdb23c2";
|
rev = "94a220cd6745e6e3f8de62870b66fd5b9bc92700";
|
||||||
hash = "sha256-x/2LOlEoaghgHEZp6m5ItXyNHGsvYmUrHYxKEtSeVSM=";
|
hash = "sha256-1jAowfGVzrrHDwWWzKESY7aV82whnuIg1N37fmtcgyw=";
|
||||||
leaveDotGit = true;
|
leaveDotGit = true;
|
||||||
postFetch = ''
|
postFetch = ''
|
||||||
git -C "$out" rev-parse --short HEAD > $out/COMMIT
|
git -C "$out" rev-parse --short HEAD > $out/COMMIT
|
||||||
find "$out" -name .git -print0 | xargs -0 rm -rf
|
find "$out" -name .git -print0 | xargs -0 rm -rf
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
# Pre-Built WebUI Assets
|
|
||||||
# As of b9151 llama.cpp removed the prebuilt WebUI from the repo and tries to
|
|
||||||
# curl them from a HuggingFace bucket at build time. That fails in the Nix
|
|
||||||
# sandbox. We build the UI from source in a separate derivation and drop the
|
|
||||||
# 4 output files into build/tools/ui/dist/ so cmake's "Priority 1: local
|
|
||||||
# assets present" branch short-circuits the network fetch.
|
|
||||||
#
|
|
||||||
# As of b9180 the source dir was renamed tools/server/webui -> tools/ui, and
|
|
||||||
# the vite plugin now writes to ../../build/tools/ui/dist relative to tools/ui.
|
|
||||||
webuiNpmDeps = pkgs.fetchNpmDeps {
|
|
||||||
name = "llama-webui-${version}-npm-deps";
|
|
||||||
inherit src;
|
|
||||||
sourceRoot = "${src.name}/tools/ui";
|
|
||||||
hash = "sha256-Iyg8FpcTKf2UYHuK7mA3cTAqVaLcQPcS0YCa5Qf01Gc=";
|
|
||||||
};
|
|
||||||
|
|
||||||
webui = pkgs.buildNpmPackage {
|
|
||||||
pname = "llama-webui";
|
|
||||||
inherit version src;
|
|
||||||
|
|
||||||
# Custom unpack: the vite plugin writes back into the source tree (tools/ui/dist),
|
|
||||||
# so it must be writable. Plain sourceRoot leaves the parent dirs in the read-only
|
|
||||||
# Nix store.
|
|
||||||
unpackPhase = ''
|
|
||||||
runHook preUnpack
|
|
||||||
cp -r ${src} llama-src
|
|
||||||
chmod -R u+w llama-src
|
|
||||||
cd llama-src/tools/ui
|
|
||||||
runHook postUnpack
|
|
||||||
'';
|
|
||||||
|
|
||||||
npmDeps = webuiNpmDeps;
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
runHook preInstall
|
|
||||||
mkdir -p $out
|
|
||||||
install -Dm644 dist/index.html $out/index.html
|
|
||||||
install -Dm644 dist/bundle.js $out/bundle.js
|
|
||||||
install -Dm644 dist/bundle.css $out/bundle.css
|
|
||||||
install -Dm644 dist/loading.html $out/loading.html
|
|
||||||
runHook postInstall
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
(pkgs.llama-cpp.override {
|
(pkgs.llama-cpp.override {
|
||||||
cudaSupport = true;
|
cudaSupport = true;
|
||||||
@@ -71,6 +27,11 @@ in
|
|||||||
(oldAttrs: {
|
(oldAttrs: {
|
||||||
inherit version src;
|
inherit version src;
|
||||||
|
|
||||||
|
# WebUI npm deps hash for our pinned src. Upstream nixpkgs builds the WebUI
|
||||||
|
# from tools/ui via `npm run build` in preConfigure (offline, using these
|
||||||
|
# deps), so no custom webui derivation / HF-bucket workaround is needed.
|
||||||
|
npmDepsHash = "sha256-1iM0LGeI9e+gZEHk46lkBe51DxIhiimfAm9o3Z3m9Ik=";
|
||||||
|
|
||||||
# Add SPIR-V Headers for Vulkan Backend
|
# Add SPIR-V Headers for Vulkan Backend
|
||||||
# Newer llama.cpp requires spirv/unified1/spirv.hpp which isn't
|
# Newer llama.cpp requires spirv/unified1/spirv.hpp which isn't
|
||||||
# pulled in by vulkan-headers alone.
|
# pulled in by vulkan-headers alone.
|
||||||
@@ -87,18 +48,4 @@ in
|
|||||||
export NIX_ENFORCE_NO_NATIVE=0
|
export NIX_ENFORCE_NO_NATIVE=0
|
||||||
${oldAttrs.preConfigure or ""}
|
${oldAttrs.preConfigure or ""}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Drop pre-built UI assets into tools/ui/dist/ so cmake's Priority 1 path
|
|
||||||
# (SRC_DIST_DIR in scripts/ui-assets.cmake) picks them up and skips the HF
|
|
||||||
# Bucket fetch. As of b9404 the lookup moved from build/tools/ui/dist to
|
|
||||||
# tools/ui/dist.
|
|
||||||
postPatch = ''
|
|
||||||
${oldAttrs.postPatch or ""}
|
|
||||||
mkdir -p tools/ui/dist
|
|
||||||
cp ${webui}/* tools/ui/dist/
|
|
||||||
'';
|
|
||||||
|
|
||||||
# Expose the WebUI sub-derivation so it can be built/tested in isolation:
|
|
||||||
# nix build .#llama-cpp.webui --builders ''
|
|
||||||
passthru = (oldAttrs.passthru or { }) // { inherit webui; };
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -100,6 +100,8 @@ in
|
|||||||
opengl = {
|
opengl = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableNvidia = true;
|
enableNvidia = true;
|
||||||
|
# GTX 1080 Ti is Pascal; NVIDIA 590+ (nixpkgs stable = 595) dropped Pascal support.
|
||||||
|
nvidiaPackage = config.boot.kernelPackages.nvidiaPackages.legacy_580;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user