From 20b8ff5064f05d81e664d21658f948e5d22207f1 Mon Sep 17 00:00:00 2001 From: William Behrens <35979547+wbehrens-on-gh@users.noreply.github.com> Date: Wed, 9 Aug 2023 11:10:35 -0500 Subject: [PATCH] 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. --- flake.nix | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 4178e97ff..1b3776e98 100644 --- a/flake.nix +++ b/flake.nix @@ -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 = {