nixos-configs/devices/nos/modules/subtitles/extract-subs/default.nix
matt1432 8d04980e50
All checks were successful
Discord / discord commits (push) Has been skipped
feat(subs): separate mgmt of subs in scripts
2024-05-18 17:51:06 -04:00

51 lines
890 B
Nix

{
buildNpmPackage,
ffmpeg-full,
nodejs_20,
typescript,
writeShellApplication,
...
}: let
pname = "extract-subs";
extract-subs = buildNpmPackage {
name = "${pname}-npm";
src = ./.;
npmDepsHash = "sha256-O00VQPCUX6T+rtK3VcAibBipXFwNs4AFA3251qycPBQ=";
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} "$@"
'';
meta.mainProgram = pname;
}