Nix flake: Use Makefile instead of CMake

I can't test whether this works on Darwin, but it can build libllama.so.

I did try building via CMake with -DBUILD_SHARED_LIBS=ON, but it did not work and I could not make it work.
This commit is contained in:
Corbin 2023-04-19 10:23:47 -07:00
parent 884e7d7a2b
commit 14a4fc874b

View file

@ -18,17 +18,21 @@
packages.default = pkgs.stdenv.mkDerivation {
name = "llama.cpp";
src = ./.;
nativeBuildInputs = with pkgs; [ cmake ];
buildInputs = with pkgs; lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Accelerate
];
cmakeFlags = with pkgs; lib.optionals (system == "aarch64-darwin") [
"-DCMAKE_C_FLAGS=-D__ARM_FEATURE_DOTPROD=1"
];
buildPhase = ''
make main quantize quantize-stats perplexity embedding vdot libllama.so
'';
installPhase = ''
mkdir -p $out/bin
mv bin/* $out/bin/
mv $out/bin/main $out/bin/llama
mkdir -p $out/lib/
cp libllama.so $out/lib/
mkdir -p $out/bin/
mv main $out/bin/llama
for exe in quantize quantize-stats perplexity embedding vdot; do
mv $exe $out/bin/
done
echo "#!${llama-python}/bin/python" > $out/bin/convert-pth-to-ggml
cat ${./convert-pth-to-ggml.py} >> $out/bin/convert-pth-to-ggml