Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

youtube2webpage: init at unstable-2023-11-09 #268480

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions pkgs/by-name/yo/youtube2webpage/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{ lib
, stdenv
, perl
, fetchFromGitHub
, yt-dlp
, ffmpeg
, makeWrapper
}:

let
mainProgram = "yt-to-webpage.pl";
src = fetchFromGitHub {
owner = "obra";
repo = "Youtube2Webpage";
rev = "d39458fafc35ed288699a3bf65321eaacb46f4cc";
hash = "sha256-u+bMY2J/IpvMrBhZzv1MN0LDaomD7qGy3RoiNEFo6Ow=";
};
in

stdenv.mkDerivation {
pname = "youtube2webpage";
version = "unstable-2023-11-09";
inherit src;

dontBuild = true;

# add a line to the script that copies styles.css into the output
postPatch = ''
substituteInPlace ${mainProgram} \
--replace \
'mkdir($slug);' \
'mkdir($slug); use File::Copy; copy("'$out'/styles.css", $slug);'
patchShebangs ${mainProgram}
'';

nativeBuildInputs = [
makeWrapper
];

buildInputs = [
perl
ffmpeg
yt-dlp
];

installPhase = ''
runHook preInstall
mkdir -p $out/bin
mv ${mainProgram} $out/bin/
chmod +x $out/bin/${mainProgram}
cp ${src}/styles.css $out
runHook postInstall
'';

preFixup = ''
wrapProgram $out/bin/${mainProgram} --prefix PATH ":" ${ffmpeg}/bin:${yt-dlp}/bin
'';

meta = with lib; {
homepage = "https://github.com/obra/Youtube2Webpage";
description = "Turns a youtube video into a webpage with screenshots and subtitles.";
license = lib.licenses.mit;
inherit mainProgram;
};
}