ollama: refactor wrapper options
This commit is contained in:
parent
42c70e2923
commit
00c876544e
@ -109,12 +109,6 @@ let
|
||||
];
|
||||
};
|
||||
|
||||
runtimeLibs = lib.optionals enableRocm [
|
||||
rocmPath
|
||||
] ++ lib.optionals enableCuda [
|
||||
linuxPackages.nvidia_x11
|
||||
];
|
||||
|
||||
appleFrameworks = darwin.apple_sdk_11_0.frameworks;
|
||||
metalFrameworks = [
|
||||
appleFrameworks.Accelerate
|
||||
@ -123,6 +117,17 @@ let
|
||||
appleFrameworks.MetalPerformanceShaders
|
||||
];
|
||||
|
||||
runtimeLibs = lib.optionals enableRocm [
|
||||
rocmPath
|
||||
] ++ lib.optionals enableCuda [
|
||||
linuxPackages.nvidia_x11
|
||||
];
|
||||
wrapperOptions = builtins.concatStringsSep " " ([
|
||||
"--suffix LD_LIBRARY_PATH : '/run/opengl-driver/lib:${lib.makeLibraryPath runtimeLibs}'"
|
||||
] ++ lib.optionals enableRocm [
|
||||
"--set-default HIP_PATH '${rocmPath}'"
|
||||
]);
|
||||
|
||||
|
||||
goBuild =
|
||||
if enableCuda then
|
||||
@ -183,10 +188,7 @@ goBuild ((lib.optionalAttrs enableRocm {
|
||||
'' + lib.optionalString (enableRocm || enableCuda) ''
|
||||
# expose runtime libraries necessary to use the gpu
|
||||
mv "$out/bin/ollama" "$out/bin/.ollama-unwrapped"
|
||||
makeWrapper "$out/bin/.ollama-unwrapped" "$out/bin/ollama" ${
|
||||
lib.optionalString enableRocm
|
||||
''--set-default HIP_PATH '${rocmPath}' ''} \
|
||||
--suffix LD_LIBRARY_PATH : '/run/opengl-driver/lib:${lib.makeLibraryPath runtimeLibs}'
|
||||
makeWrapper "$out/bin/.ollama-unwrapped" "$out/bin/ollama" ${wrapperOptions}
|
||||
'';
|
||||
|
||||
ldflags = [
|
||||
|
Loading…
Reference in New Issue
Block a user