Skip to content

Commit 498e998

Browse files
committed
buildStatic variable to toggle static builds
1 parent 51ec91b commit 498e998

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

.devops/nix/package.nix

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
pkgs,
32
lib,
3+
glibc,
44
config,
55
stdenv,
66
mkShell,
@@ -31,6 +31,7 @@
3131
useRocm ? config.rocmSupport,
3232
useVulkan ? false,
3333
llamaVersion ? "0.0.0", # Arbitrary version, substituted by the flake
34+
buildStatic ? false,
3435
}@inputs:
3536

3637
let
@@ -161,14 +162,16 @@ effectiveStdenv.mkDerivation (
161162
ninja
162163
pkg-config
163164
git
164-
pkgs.glibc.static
165165
]
166166
++ optionals useCuda [
167167
cudaPackages.cuda_nvcc
168168

169169
# TODO: Replace with autoAddDriverRunpath
170170
# once https://github.com/NixOS/nixpkgs/pull/275241 has been merged
171171
cudaPackages.autoAddOpenGLRunpathHook
172+
]
173+
++ optionals buildStatic [
174+
glibc.static
172175
];
173176

174177
buildInputs =
@@ -183,7 +186,7 @@ effectiveStdenv.mkDerivation (
183186
[
184187
(cmakeBool "LLAMA_NATIVE" false)
185188
(cmakeBool "LLAMA_BUILD_SERVER" true)
186-
(cmakeBool "BUILD_SHARED_LIBS" false)
189+
(cmakeBool "BUILD_SHARED_LIBS" !buildStatic)
187190
(cmakeBool "CMAKE_SKIP_BUILD_RPATH" true)
188191
(cmakeBool "LLAMA_BLAS" useBlas)
189192
(cmakeBool "LLAMA_CLBLAST" useOpenCL)
@@ -192,7 +195,7 @@ effectiveStdenv.mkDerivation (
192195
(cmakeBool "LLAMA_METAL" useMetalKit)
193196
(cmakeBool "LLAMA_MPI" useMpi)
194197
(cmakeBool "LLAMA_VULKAN" useVulkan)
195-
(cmakeBool "LLAMA_STATIC" true)
198+
(cmakeBool "LLAMA_STATIC" buildStatic)
196199
]
197200
++ optionals useCuda [
198201
(

0 commit comments

Comments
 (0)