config/pkgs/v4l2-play/default.nix

61 lines
1.0 KiB
Nix

{
lib,
pkgs,
}:
let
runtimeInputs = with pkgs; [
ffmpeg
v4l-utils
alsa-utils
gnome.zenity
lxterminal
];
in
pkgs.stdenvNoCC.mkDerivation (finalAttrs: {
name = "v4l2-play";
meta.mainProgram = "v4l2-play";
nativeBuildInputs = with pkgs; [
makeWrapper
copyDesktopItems
];
dontUnpack = true;
dontBuild = true;
dontConfigure = true;
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp ${./script.sh} $out/bin/v4l2-play
chmod +wx $out/bin/v4l2-play
substituteInPlace $out/bin/v4l2-play \
--replace-fail \
"#!/usr/bin/env nix-shell" \
"#!${pkgs.runtimeShell}"
wrapProgram $out/bin/v4l2-play \
--prefix PATH : ${lib.makeBinPath runtimeInputs}
runHook postInstall
'';
desktopItems = pkgs.makeDesktopItem {
name = "v4l2-play";
desktopName = "View video device";
exec = "v4l2-play";
keywords = [
"elgato"
"passthrough"
"v4l2"
"video4linux2"
"capture card"
];
};
})