Add headers to nix packages

Previously it was only copying the libs and binaries. This change should allow anyone using the flake to include the headers in their project.
This commit is contained in:
William Behrens 2023-08-09 11:10:35 -05:00 committed by GitHub
parent 25d43e0eb5
commit 20b8ff5064
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,6 +38,16 @@
postInstall = ''
mv $out/bin/main $out/bin/llama
mv $out/bin/server $out/bin/llama-server
mkdir $out/include
cp $src/llama.h $out/include
cp $src/llama-util.h $out/include
cp $src/ggml.h $out/include
cp $src/ggml-alloc.h $out/include
cp $src/k_quants.h $out/include
cp $src/ggml-mpi.h $out/include
'';
cmakeFlags = [ "-DLLAMA_BUILD_SERVER=ON" "-DLLAMA_MPI=ON" "-DBUILD_SHARED_LIBS=ON" "-DCMAKE_SKIP_BUILD_RPATH=ON" ];
in {
@ -55,7 +65,8 @@
"-DLLAMA_BLAS=ON"
"-DLLAMA_BLAS_VENDOR=OpenBLAS"
]);
postInstall = postInstall;
postInstall = (if isAarch64 && isDarwin then
nixpkgs.lib.concatLines [postInstall "cp $src/ggml-metal.h $out/include"] else postInstall);
meta.mainProgram = "llama";
};
packages.opencl = pkgs.stdenv.mkDerivation {
@ -67,7 +78,7 @@
cmakeFlags = cmakeFlags ++ [
"-DLLAMA_CLBLAST=ON"
];
postInstall = postInstall;
postInstall = nixpkgs.lib.concatLines [postInstall "cp $src/ggml-opencl.h $out/include"];
meta.mainProgram = "llama";
};
apps.llama-server = {