49 lines
1.4 KiB
Nix
49 lines
1.4 KiB
Nix
{ pkgs }:
|
|
let
|
|
# Version MUST be an integer string.
|
|
# For tagged releases use the tag number (e.g. "9222").
|
|
# For HEAD builds use YYYYMMDD (e.g. "20260519").
|
|
version = "10159";
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
owner = "ggml-org";
|
|
repo = "llama.cpp";
|
|
rev = "f95de9776b5b90dd993f36d2bd66a3eee21c887f";
|
|
hash = "sha256-xWvOe1yub0wxwCnfLxfDi8EP6hSmCdBkfjRP3NAt/IQ=";
|
|
leaveDotGit = true;
|
|
postFetch = ''
|
|
git -C "$out" rev-parse --short HEAD > $out/COMMIT
|
|
find "$out" -name .git -print0 | xargs -0 rm -rf
|
|
'';
|
|
};
|
|
in
|
|
(pkgs.llama-cpp.override {
|
|
cudaSupport = true;
|
|
blasSupport = true;
|
|
rocmSupport = false;
|
|
metalSupport = false;
|
|
vulkanSupport = true;
|
|
}).overrideAttrs
|
|
(oldAttrs: {
|
|
inherit version src;
|
|
|
|
npmDepsHash = "sha256-B7uEynAG70a3xauBKc20RuFa9cnWaWzVBCh+LPLBnIM=";
|
|
|
|
# Add SPIR-V Headers for Vulkan Backend
|
|
# Newer llama.cpp requires spirv/unified1/spirv.hpp which isn't
|
|
# pulled in by vulkan-headers alone.
|
|
buildInputs = (oldAttrs.buildInputs or [ ]) ++ [ pkgs.spirv-headers ];
|
|
|
|
# Auto CPU Optimizations
|
|
cmakeFlags = (oldAttrs.cmakeFlags or [ ]) ++ [
|
|
"-DGGML_CUDA_ENABLE_UNIFIED_MEMORY=1"
|
|
"-DCMAKE_CUDA_ARCHITECTURES=61;86" # GTX 1070 / GTX 1080ti / RTX 3090
|
|
];
|
|
|
|
# Disable Nix's march=native Stripping
|
|
preConfigure = ''
|
|
export NIX_ENFORCE_NO_NATIVE=0
|
|
${oldAttrs.preConfigure or ""}
|
|
'';
|
|
})
|