mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-12-21 19:24:15 +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
|
||||
, fetchurl
|
||||
{ stdenv
|
||||
, autoPatchelfHook
|
||||
, fetchFromGitHub
|
||||
, fetchzip
|
||||
, gcc-unwrapped
|
||||
, jre
|
||||
, makeWrapper
|
||||
, unzip
|
||||
, ocamlPackages
|
||||
, model ? "small"
|
||||
}:
|
||||
|
||||
let
|
||||
|
||||
pname = "mp4grep";
|
||||
version = "0.1.1";
|
||||
|
||||
files = stdenv.mkDerivation
|
||||
{
|
||||
pname = "${pname}-files";
|
||||
inherit version;
|
||||
src = fetchurl {
|
||||
url = "https://github.com/o-oconnell/${pname}/releases/download/v${version}/${pname}-${version}.zip";
|
||||
sha256 = "3e63a9097ca8046eb22effee075aac71179a3c94d463049c42397a10f4087d8b";
|
||||
# https://alphacephei.com/vosk/models
|
||||
models = {
|
||||
big = fetchzip {
|
||||
url = "https://alphacephei.com/vosk/models/vosk-model-en-us-0.22.zip";
|
||||
hash = "sha256-kakOhA7hEtDM6WY3oAnb8xKZil9WTA3xePpLIxr2+yM=";
|
||||
};
|
||||
nativeBuildInputs = [ makeWrapper unzip ];
|
||||
installPhase = ''
|
||||
cp -a . $out
|
||||
makeWrapper $out/bin/${pname} $out/launch \
|
||||
--set JAVA_HOME ${jre} \
|
||||
small = fetchzip {
|
||||
url = "https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip";
|
||||
hash = "sha256-CIoPZ/krX+UW2w7c84W3oc1n4zc9BBS/fc8rVYUthuY=";
|
||||
};
|
||||
};
|
||||
|
||||
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"' \
|
||||
--suffix LD_LIBRARY_PATH : ${lib.getLib gcc-unwrapped}/lib \
|
||||
--add-flags "--model $out/model"
|
||||
--run 'mkdir -p "$MP4GREP_CACHE"' \
|
||||
--set MP4GREP_MODEL ${models.${model}}
|
||||
'';
|
||||
};
|
||||
|
||||
in
|
||||
stdenv.mkDerivation
|
||||
stdenv.mkDerivation rec
|
||||
{
|
||||
inherit pname version;
|
||||
dontUnpack = true;
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
pname = "mp4grep";
|
||||
version = "0.1.4";
|
||||
|
||||
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 = ''
|
||||
mkdir -p $out/bin
|
||||
ln -s ${files}/launch $out/bin/mp4grep
|
||||
install -D $MP4GREP_INSTALL_PREFIX/mp4grep-libs/libvosk.so $out/share/mp4grep/libvosk.so
|
||||
${installBin "mp4grep"}
|
||||
${installBin "mp4grep-convert"}
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue