mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-10-30 06:30:15 +01:00
nix: static build (#5814)
This commit is contained in:
parent
29ae62d2ae
commit
1d41d6f7c2
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
|
glibc,
|
||||||
config,
|
config,
|
||||||
stdenv,
|
stdenv,
|
||||||
mkShell,
|
mkShell,
|
||||||
@ -30,6 +31,11 @@
|
|||||||
useRocm ? config.rocmSupport,
|
useRocm ? config.rocmSupport,
|
||||||
useVulkan ? false,
|
useVulkan ? false,
|
||||||
llamaVersion ? "0.0.0", # Arbitrary version, substituted by the flake
|
llamaVersion ? "0.0.0", # Arbitrary version, substituted by the flake
|
||||||
|
|
||||||
|
# It's necessary to consistently use backendStdenv when building with CUDA support,
|
||||||
|
# otherwise we get libstdc++ errors downstream.
|
||||||
|
effectiveStdenv ? if useCuda then cudaPackages.backendStdenv else stdenv,
|
||||||
|
enableStatic ? effectiveStdenv.hostPlatform.isStatic
|
||||||
}@inputs:
|
}@inputs:
|
||||||
|
|
||||||
let
|
let
|
||||||
@ -41,10 +47,7 @@ let
|
|||||||
versionOlder
|
versionOlder
|
||||||
;
|
;
|
||||||
|
|
||||||
# It's necessary to consistently use backendStdenv when building with CUDA support,
|
|
||||||
# otherwise we get libstdc++ errors downstream.
|
|
||||||
stdenv = throw "Use effectiveStdenv instead";
|
stdenv = throw "Use effectiveStdenv instead";
|
||||||
effectiveStdenv = if useCuda then cudaPackages.backendStdenv else inputs.stdenv;
|
|
||||||
|
|
||||||
suffices =
|
suffices =
|
||||||
lib.optionals useBlas [ "BLAS" ]
|
lib.optionals useBlas [ "BLAS" ]
|
||||||
@ -167,6 +170,9 @@ effectiveStdenv.mkDerivation (
|
|||||||
# TODO: Replace with autoAddDriverRunpath
|
# TODO: Replace with autoAddDriverRunpath
|
||||||
# once https://github.com/NixOS/nixpkgs/pull/275241 has been merged
|
# once https://github.com/NixOS/nixpkgs/pull/275241 has been merged
|
||||||
cudaPackages.autoAddOpenGLRunpathHook
|
cudaPackages.autoAddOpenGLRunpathHook
|
||||||
|
]
|
||||||
|
++ optionals (effectiveStdenv.hostPlatform.isGnu && enableStatic) [
|
||||||
|
glibc.static
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs =
|
buildInputs =
|
||||||
@ -181,7 +187,7 @@ effectiveStdenv.mkDerivation (
|
|||||||
[
|
[
|
||||||
(cmakeBool "LLAMA_NATIVE" false)
|
(cmakeBool "LLAMA_NATIVE" false)
|
||||||
(cmakeBool "LLAMA_BUILD_SERVER" true)
|
(cmakeBool "LLAMA_BUILD_SERVER" true)
|
||||||
(cmakeBool "BUILD_SHARED_LIBS" true)
|
(cmakeBool "BUILD_SHARED_LIBS" (!enableStatic))
|
||||||
(cmakeBool "CMAKE_SKIP_BUILD_RPATH" true)
|
(cmakeBool "CMAKE_SKIP_BUILD_RPATH" true)
|
||||||
(cmakeBool "LLAMA_BLAS" useBlas)
|
(cmakeBool "LLAMA_BLAS" useBlas)
|
||||||
(cmakeBool "LLAMA_CLBLAST" useOpenCL)
|
(cmakeBool "LLAMA_CLBLAST" useOpenCL)
|
||||||
@ -190,6 +196,7 @@ effectiveStdenv.mkDerivation (
|
|||||||
(cmakeBool "LLAMA_METAL" useMetalKit)
|
(cmakeBool "LLAMA_METAL" useMetalKit)
|
||||||
(cmakeBool "LLAMA_MPI" useMpi)
|
(cmakeBool "LLAMA_MPI" useMpi)
|
||||||
(cmakeBool "LLAMA_VULKAN" useVulkan)
|
(cmakeBool "LLAMA_VULKAN" useVulkan)
|
||||||
|
(cmakeBool "LLAMA_STATIC" enableStatic)
|
||||||
]
|
]
|
||||||
++ optionals useCuda [
|
++ optionals useCuda [
|
||||||
(
|
(
|
||||||
|
Loading…
Reference in New Issue
Block a user