mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-11-09 18:47:02 +00:00
mp4grep: 0.1.1 -> 0.1.4
This commit is contained in:
parent
6000f8cd07
commit
6bad570ffc
2 changed files with 60 additions and 32 deletions
3
pkgs/mp4grep-big.nix
Normal file
3
pkgs/mp4grep-big.nix
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{ callPackage }:
|
||||||
|
|
||||||
|
callPackage ./mp4grep.nix { model = "big"; }
|
|
@ -1,44 +1,69 @@
|
||||||
{ lib
|
{ stdenv
|
||||||
, stdenv
|
, autoPatchelfHook
|
||||||
, fetchurl
|
, fetchFromGitHub
|
||||||
|
, fetchzip
|
||||||
, gcc-unwrapped
|
, gcc-unwrapped
|
||||||
, jre
|
|
||||||
, makeWrapper
|
, makeWrapper
|
||||||
, unzip
|
, ocamlPackages
|
||||||
|
, model ? "small"
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
# https://alphacephei.com/vosk/models
|
||||||
pname = "mp4grep";
|
models = {
|
||||||
version = "0.1.1";
|
big = fetchzip {
|
||||||
|
url = "https://alphacephei.com/vosk/models/vosk-model-en-us-0.22.zip";
|
||||||
files = stdenv.mkDerivation
|
hash = "sha256-kakOhA7hEtDM6WY3oAnb8xKZil9WTA3xePpLIxr2+yM=";
|
||||||
{
|
|
||||||
pname = "${pname}-files";
|
|
||||||
inherit version;
|
|
||||||
src = fetchurl {
|
|
||||||
url = "https://github.com/o-oconnell/${pname}/releases/download/v${version}/${pname}-${version}.zip";
|
|
||||||
sha256 = "3e63a9097ca8046eb22effee075aac71179a3c94d463049c42397a10f4087d8b";
|
|
||||||
};
|
};
|
||||||
nativeBuildInputs = [ makeWrapper unzip ];
|
small = fetchzip {
|
||||||
installPhase = ''
|
url = "https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip";
|
||||||
cp -a . $out
|
hash = "sha256-CIoPZ/krX+UW2w7c84W3oc1n4zc9BBS/fc8rVYUthuY=";
|
||||||
makeWrapper $out/bin/${pname} $out/launch \
|
};
|
||||||
--set JAVA_HOME ${jre} \
|
};
|
||||||
|
|
||||||
|
installBin = bin: ''
|
||||||
|
install -D $MP4GREP_INSTALL_PREFIX/${bin} $out/share/mp4grep/${bin}
|
||||||
|
makeWrapper $out/share/mp4grep/${bin} $out/bin/${bin} \
|
||||||
--run 'export MP4GREP_CACHE="$HOME/.cache/mp4grep"' \
|
--run 'export MP4GREP_CACHE="$HOME/.cache/mp4grep"' \
|
||||||
--suffix LD_LIBRARY_PATH : ${lib.getLib gcc-unwrapped}/lib \
|
--run 'mkdir -p "$MP4GREP_CACHE"' \
|
||||||
--add-flags "--model $out/model"
|
--set MP4GREP_MODEL ${models.${model}}
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation
|
stdenv.mkDerivation rec
|
||||||
{
|
{
|
||||||
inherit pname version;
|
pname = "mp4grep";
|
||||||
dontUnpack = true;
|
version = "0.1.4";
|
||||||
nativeBuildInputs = [ makeWrapper ];
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "o-oconnell";
|
||||||
|
repo = "mp4grep";
|
||||||
|
rev = "${version}-linux-x86";
|
||||||
|
sha256 = "HsZZ+KDf4bpdvJjM42vh5u1gKhGSH+g6zYS0pRM5aTU=";
|
||||||
|
};
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
gcc-unwrapped.lib
|
||||||
|
];
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
autoPatchelfHook
|
||||||
|
makeWrapper
|
||||||
|
ocamlPackages.ocaml
|
||||||
|
];
|
||||||
|
|
||||||
|
dontStrip = true;
|
||||||
|
OPAM_SWITCH_PREFIX = ".";
|
||||||
|
MP4GREP_INSTALL_PREFIX = "./bin-nix";
|
||||||
|
|
||||||
|
preBuild = ''
|
||||||
|
mkdir $MP4GREP_INSTALL_PREFIX
|
||||||
|
ln -s ${ocamlPackages.parmap}/lib/ocaml/4.14.0/site-lib/parmap $OPAM_SWITCH_PREFIX/lib/
|
||||||
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/bin
|
install -D $MP4GREP_INSTALL_PREFIX/mp4grep-libs/libvosk.so $out/share/mp4grep/libvosk.so
|
||||||
ln -s ${files}/launch $out/bin/mp4grep
|
${installBin "mp4grep"}
|
||||||
|
${installBin "mp4grep-convert"}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue