From b095898a01dd3bf434488a18f887e718e2f5e528 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Mon, 6 Mar 2023 21:57:54 +0100 Subject: [PATCH] whisper_cpp: init at 1.2.0 --- default.nix | 2 ++ flake.nix | 3 ++- whisper_cpp/default.nix | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 whisper_cpp/default.nix diff --git a/default.nix b/default.nix index fa932c0..6ca52d1 100644 --- a/default.nix +++ b/default.nix @@ -45,4 +45,6 @@ in unxwb = callPackage ./unxwb { }; VisiCut = callPackage ./VisiCut { }; + + whisper_cpp = callPackage ./whisper_cpp { }; } diff --git a/flake.nix b/flake.nix index f727fae..d8e31d7 100644 --- a/flake.nix +++ b/flake.nix @@ -58,7 +58,8 @@ nsz playgsf textidote - unxwb; + unxwb + whisper_cpp; mpvScripts = lib.recurseIntoAttrs { inherit (pkgs.mpvScripts) diff --git a/whisper_cpp/default.nix b/whisper_cpp/default.nix new file mode 100644 index 0000000..2352986 --- /dev/null +++ b/whisper_cpp/default.nix @@ -0,0 +1,33 @@ +{ lib, stdenv, fetchFromGitHub }: + +stdenv.mkDerivation rec { + pname = "whisper.cpp"; + version = "1.2.0"; + + src = fetchFromGitHub { + owner = "ggerganov"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-7/10t1yE7Gbs+cyj8I9vJoDeaxEz9Azc2j3f6QCjDGM="; + }; + + postPatch = '' + substituteInPlace models/download-ggml-model.sh \ + --replace 'models_path="$(get_script_path)"' 'models_path="$HOME/.local/share/whisper_cpp"' + ''; + + installPhase = '' + runHook preInstall + install -D main $out/bin/${pname} + install -D models/download-ggml-model.sh $out/bin/download-ggml-model + runHook postInstall + ''; + + meta = with lib; { + description = "Port of OpenAI's Whisper model in C/C++"; + homepage = "https://github.com/ggerganov/whisper.cpp/"; + license = licenses.mit; + maintainers = with maintainers; [ sbruder ]; + platforms = platforms.unix; + }; +}