pvv-chan/flake.nix

105 lines
3.9 KiB
Nix
Raw Normal View History

2024-05-27 18:42:18 +02:00
{
description = "A simple flake";
inputs.nixpkgs.url = "nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }: {
defaultPackage.x86_64-linux = let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
python = pkgs.python311;
pythonPackages = python.pkgs;
piper_model_url = "https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_US/hfc_female/medium/en_US-hfc_female-medium.onnx?download=true";
piper_model_json_url = "https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_US/hfc_female/medium/en_US-hfc_female-medium.onnx.json?download=true.json";
whisper_model_tiny_url = "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny.bin?download=true";
whisper_model_base_url = "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-base.bin?download=true";
whisper_model_small_url = "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.bin?download=true";
whisper_model_small_tdrz_url = "https://huggingface.co/akashmjn/tinydiarize-whisper.cpp/resolve/main/ggml-small.en-tdrz.bin?download=true";
haracascade_face_url = "https://raw.githubusercontent.com/opencv/opencv/master/data/haarcascades/haarcascade_frontalface_default.xml";
piper_model = pkgs.fetchurl {
name = "hfc_female/medium/en_US-hfc_female-medium.onnx";
url = piper_model_url;
sha256 = "sha256-kUxHN4j8H6i2Os4c3NtEWI9K5SPTqzffFTZhaDWhQLc="; # replace with the correct sha256
};
piper_model_json = pkgs.fetchurl {
name = "hfc_female/medium/en_US-hfc_female-medium.onnx.json";
url = piper_model_json_url;
sha256 = "sha256-A/H6BiK4BGMoNZLZesqfbomuw0WlxWtyV3I+AJPFi2w="; # replace with the correct sha256
};
whisper_model_tiny = pkgs.fetchurl {
name = "ggml-tiny.bin";
url = whisper_model_tiny_url;
sha256 = "sha256-vgfgSOHlma1GNByNKhNWRQl6U4IhZ4t6zdGxkZxuGyE=";
};
whisper_model_base = pkgs.fetchurl {
name = "ggml-base.bin";
url = whisper_model_base_url;
sha256 = "sha256-YO1bw90U7qhWST0zQ0m0BXgt3K8AKNS130CINF+6Lv4=";
};
whisper_model_small = pkgs.fetchurl {
name = "ggml-small.bin";
url = whisper_model_small_url;
sha256 = "sha256-G+OpsgY4Z7k35k4ux0gzZKeZF+FX+pjF2UtcH//qmHs=";
};
whisper_model_small_tdrz = pkgs.fetchurl {
name = "ggml-small.en-tdrz.bin";
url = whisper_model_small_url;
sha256 = "sha256-G+OpsgY4Z7k35k4ux0gzZKeZF+FX+pjF2UtcH//qmHs=";
};
haracascade_face = pkgs.fetchurl {
name = "haarcascade_frontalface_default.xml";
url = haracascade_face_url;
sha256 = "sha256-D31FJ4ROtRTUpJSOgi2pD7sWo0oLu7xq3GSYdHpar7A=";
};
in pkgs.mkShell {
nativeBuildInputs = with pkgs; [
python
piper-tts
alsa-utils # for aplay for piper-tts to stream to
openai-whisper-cpp # for stt
opencv
(pythonPackages.numpy)
(pythonPackages.pytorch)
(pythonPackages.langchain)
(pythonPackages.mwxml)
(pythonPackages.mwparserfromhell) #dependency langchain document fetcher
(pythonPackages.sentence-transformers) #dependency for langchain embedding
(pythonPackages.chromadb) #vector search
(pythonPackages.opencv4)
(pythonPackages.pillow)
];
WHISPER_AUDIO_DEVICE = "1";
WHISPER_MODEL_PATH = whisper_model_tiny;
PIPER_MODEL_PATH = piper_model;
PIPER_MODEL_JSON_PATH =piper_model_json;
HARA_CASCADE_FACE_PATH = haracascade_face;
OLLAMA_HOST = "http://localhost:11434";
IMAGE_DESCRIPTION_CAMERA = "0";
IMAGE_DESCRIPTION_MODEL = "llava";
shellHook = ''
#need to set ollama url first, before pulling models needed for the project
ollama pull llava
ollama pull llama3
'';
};
};
}