2024-03-26 11:31:59 -04:00
|
|
|
{
|
|
|
|
buildNpmPackage,
|
2024-05-18 17:51:06 -04:00
|
|
|
ffmpeg-full,
|
2024-03-26 11:31:59 -04:00
|
|
|
nodejs_20,
|
|
|
|
typescript,
|
2024-05-18 17:51:06 -04:00
|
|
|
writeShellApplication,
|
2024-03-26 11:31:59 -04:00
|
|
|
...
|
2024-04-01 16:40:04 -04:00
|
|
|
}: let
|
2024-05-18 17:51:06 -04:00
|
|
|
pname = "extract-subs";
|
|
|
|
|
|
|
|
extract-subs = buildNpmPackage {
|
|
|
|
name = "${pname}-npm";
|
2024-04-01 16:40:04 -04:00
|
|
|
src = ./.;
|
|
|
|
npmDepsHash = "sha256-O00VQPCUX6T+rtK3VcAibBipXFwNs4AFA3251qycPBQ=";
|
2024-03-26 11:31:59 -04:00
|
|
|
|
2024-04-01 16:40:04 -04:00
|
|
|
nativeBuildInputs = [
|
|
|
|
nodejs_20
|
|
|
|
typescript
|
|
|
|
];
|
2024-03-26 11:31:59 -04:00
|
|
|
|
2024-04-01 16:40:04 -04:00
|
|
|
buildPhase = ''
|
|
|
|
tsc -p tsconfig.json
|
|
|
|
'';
|
2024-03-26 11:31:59 -04:00
|
|
|
|
2024-04-01 16:40:04 -04:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
mv node_modules package.json $out
|
2024-03-26 11:31:59 -04:00
|
|
|
|
2024-05-18 17:51:06 -04:00
|
|
|
echo '#!/usr/bin/env node' > $out/bin/${pname}
|
|
|
|
cat ./build/main.js >> $out/bin/${pname}
|
2024-04-01 16:40:04 -04:00
|
|
|
rm ./build/main.js
|
2024-05-18 17:51:06 -04:00
|
|
|
chmod +x $out/bin/${pname}
|
2024-04-01 16:40:04 -04:00
|
|
|
|
|
|
|
mv ./build/**.js $out/bin
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
in
|
2024-05-18 17:51:06 -04:00
|
|
|
writeShellApplication {
|
|
|
|
name = pname;
|
|
|
|
|
|
|
|
runtimeInputs = [
|
|
|
|
ffmpeg-full
|
|
|
|
extract-subs
|
2024-04-01 16:40:04 -04:00
|
|
|
];
|
2024-05-18 17:51:06 -04:00
|
|
|
|
|
|
|
text = ''
|
|
|
|
exec ${pname} "$@"
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta.mainProgram = pname;
|
2024-04-01 16:40:04 -04:00
|
|
|
}
|