Skip to content

Commit

Permalink
use better approach for overriding llama.cpp--accompanied by PR:
Browse files Browse the repository at this point in the history
ggerganov/llama.cpp#2224

...also adds MIT LICENSE, just making it consistent with llama.cpp.
  • Loading branch information
ddellacosta committed Jul 14, 2023
1 parent df2b8e1 commit e485be2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
9 changes: 9 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The MIT License (MIT)

Copyright © 2023 Dave Della Costa

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@

llama-cpp-with-includes =
llama-cpp.packages.${system}.default.overrideAttrs (oldAttrs: {
postInstallHook = (oldAttrs.postInstallHook or "") + ''
postInstall = (oldAttrs.postInstall or "") + ''
mkdir -p $out/lib
mkdir -p $out/include
cp *.a $out/lib/
for i in $src/*.h; do cp $i $out/include/; done
'';
});

Expand All @@ -27,7 +31,7 @@
addBuildTools = (t.flip hl.addBuildTools) (devTools ++ [
zlib
haskellPackages.c2hs
# llama-cpp.packages.${system}.default
llama-cpp-with-includes
]);
in
haskellPackages.developPackage {
Expand All @@ -40,11 +44,10 @@
modifier = (t.flip t.pipe) [
addBuildTools
hl.dontHaddock
# hl.appendBuildFlag "--extra-include-dirs=${llama-cpp.outPath}"
(drv: hl.overrideCabal drv (attrs: {
configureFlags = [
"--extra-include-dirs=${llama-cpp.packages.${system}.default}/include"
# "--extra-lib-dirs=${llama-cpp.outPath}/lib"
"--extra-include-dirs=${llama-cpp-with-includes}/include"
"--extra-lib-dirs=${llama-cpp-with-includes}/lib"
];
}))
];
Expand All @@ -54,6 +57,7 @@
packages = {
pkg = project [ ]; # [3]
default = self.packages.${system}.pkg;
llama-cpp = llama-cpp-with-includes;
};

devShell = project (with haskellPackages; [ # [4]
Expand Down

0 comments on commit e485be2

Please sign in to comment.