nixos-configs/devices/nos/modules/subtitles/extract-subs/default.nix
matt1432 021e233da1
All checks were successful
Discord / discord commits (push) Has been skipped
chore: bump all package.json files
2024-10-12 13:09:59 -04:00

49 lines
859 B
Nix

{
buildNpmPackage,
ffmpeg-full,
nodejs_20,
typescript,
writeShellApplication,
...
}: let
pname = "extract-subs";
extract-subs = buildNpmPackage {
name = "${pname}-npm";
src = ./.;
npmDepsHash = "sha256-mIRn7MsQJCwBYNEL3IK4cV8X+kDouEdc9x59XWgUkYw=";
nativeBuildInputs = [
nodejs_20
typescript
];
buildPhase = ''
tsc -p tsconfig.json
'';
installPhase = ''
mkdir -p $out/bin
mv node_modules package.json $out
echo '#!/usr/bin/env node' > $out/bin/${pname}
cat ./build/main.js >> $out/bin/${pname}
rm ./build/main.js
chmod +x $out/bin/${pname}
mv ./build/**.js $out/bin
'';
};
in
writeShellApplication {
name = pname;
runtimeInputs = [
ffmpeg-full
extract-subs
];
text = ''
exec ${pname} "$@"
'';
}