diff options
author | Christian Kögler <ck3d@gmx.de> | 2024-03-23 20:24:55 +0100 |
---|---|---|
committer | Christian Kögler <ck3d@gmx.de> | 2024-03-23 20:24:55 +0100 |
commit | a8853c6b021b434a5400756fec519d1c5bf4c9d7 (patch) | |
tree | f918476d7c5429d460602dade55be2ca3ef2febf /pkgs/by-name/lo | |
parent | 3a14bff91f6b180ee64d70e6eca4eee7b0cc02d6 (diff) |
local-ai: reuse derivation ncnn for go-tiny-dream
Diffstat (limited to 'pkgs/by-name/lo')
-rw-r--r-- | pkgs/by-name/lo/local-ai/package.nix | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/pkgs/by-name/lo/local-ai/package.nix b/pkgs/by-name/lo/local-ai/package.nix index 86d300423c81c..328712ba3d046 100644 --- a/pkgs/by-name/lo/local-ai/package.nix +++ b/pkgs/by-name/lo/local-ai/package.nix @@ -26,6 +26,7 @@ , enable_fma ? true , with_tinydream ? false +, ncnn , with_openblas ? false , openblas @@ -262,6 +263,22 @@ let ''; }; + go-tiny-dream-ncnn = ncnn.overrideAttrs (self: { + name = "go-tiny-dream-ncnn"; + inherit (go-tiny-dream) src; + sourceRoot = "source/ncnn"; + cmakeFlags = self.cmakeFlags ++ [ + (lib.cmakeBool "NCNN_SHARED_LIB" false) + (lib.cmakeBool "NCNN_OPENMP" false) + (lib.cmakeBool "NCNN_VULKAN" false) + (lib.cmakeBool "NCNN_AVX" enable_avx) + (lib.cmakeBool "NCNN_AVX2" enable_avx2) + (lib.cmakeBool "NCNN_AVX512" enable_avx512) + (lib.cmakeBool "NCNN_FMA" enable_fma) + (lib.cmakeBool "NCNN_F16C" enable_f16c) + ]; + }); + go-tiny-dream = stdenv.mkDerivation { name = "go-tiny-dream"; src = fetchFromGitHub { @@ -271,16 +288,15 @@ let hash = "sha256-r+wzFIjaI6cxAm/eXN3q8LRZZz+lE5EA4lCTk5+ZnIY="; fetchSubmodules = true; }; - patchPhase = '' - sed -i Makefile \ - -e 's;lib/libncnn;lib64/libncnn;g' + postUnpack = '' + rm -rf source/ncnn + mkdir -p source/ncnn/build + cp -r --no-preserve=mode ${go-tiny-dream-ncnn} source/ncnn/build/install ''; buildFlags = [ "libtinydream.a" ]; - dontUseCmakeConfigure = true; - nativeBuildInputs = [ cmake ]; installPhase = '' mkdir $out - tar cf - --exclude=CMakeFiles --exclude="*.o" --exclude="*.so" --exclude="*.so.*" . \ + tar cf - --exclude="*.o" . \ | tar xf - -C $out ''; meta.broken = lib.versionOlder go-tiny-dream.stdenv.cc.version "13"; @@ -408,7 +424,7 @@ let passthru.local-packages = { inherit go-tiny-dream go-rwkv go-bert go-llama-ggml gpt4all go-piper - llama-cpp-grpc whisper-cpp; + llama-cpp-grpc whisper-cpp go-tiny-dream-ncnn; }; passthru.features = { |