nixpkgs/pkgs/applications/video/pipe-viewer/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

88 lines
2.1 KiB
Nix
Raw Normal View History

2021-08-31 09:13:13 +00:00
{ lib
, fetchFromGitHub
, perl
, buildPerlModule
, makeWrapper
, wrapGAppsHook
, withGtk3 ? false
, ffmpeg
, wget
, xdg-utils
, youtube-dl
, yt-dlp
, TestPod
, Gtk3
}:
let
perlEnv = perl.withPackages (ps: with ps; [
AnyURIEscape
DataDump
Encode
FilePath
GetoptLong
HTTPMessage
JSON
JSONXS
LWPProtocolHttps
LWPUserAgentCached
Memoize
PathTools
ScalarListUtils
TermReadLineGnu
TextParsewords
UnicodeLineBreak
] ++ lib.optionals withGtk3 [
FileShareDir
]);
in
buildPerlModule rec {
pname = "pipe-viewer";
2022-09-09 18:53:43 +00:00
version = "0.3.0";
2021-08-31 09:13:13 +00:00
src = fetchFromGitHub {
owner = "trizen";
repo = "pipe-viewer";
rev = version;
2022-09-09 18:53:43 +00:00
hash = "sha256-2Kzo7NYxARPFuOijwf2a3WQxnNumtKRiRhMhjrWA4GY=";
2021-08-31 09:13:13 +00:00
};
nativeBuildInputs = [ makeWrapper ]
++ lib.optionals withGtk3 [ wrapGAppsHook ];
buildInputs = [ perlEnv ]
# Can't be in perlEnv for wrapGAppsHook to work correctly
++ lib.optional withGtk3 Gtk3;
# Not supported by buildPerlModule
# and the Perl code fails anyway
# when Getopt::Long sets $gtk in Build.PL:
# Modification of a read-only value attempted at /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-perl5.34.0-Getopt-Long-2.52/lib/perl5/site_perl/5.34.0/Getopt/Long.pm line 585.
#buildFlags = lib.optional withGtk3 "--gtk3";
postPatch = lib.optionalString withGtk3 ''
substituteInPlace Build.PL --replace 'my $gtk ' 'my $gtk = 1;#'
'';
checkInputs = [
TestPod
];
dontWrapGApps = true;
postFixup = ''
wrapProgram "$out/bin/pipe-viewer" \
--prefix PATH : "${lib.makeBinPath [ ffmpeg wget youtube-dl yt-dlp ]}"
'' + lib.optionalString withGtk3 ''
# make xdg-open overrideable at runtime
2021-08-31 09:13:13 +00:00
wrapProgram "$out/bin/gtk-pipe-viewer" ''${gappsWrapperArgs[@]} \
--prefix PATH : "${lib.makeBinPath [ ffmpeg wget youtube-dl yt-dlp ]}" \
--suffix PATH : "${lib.makeBinPath [ xdg-utils ]}"
2021-08-31 09:13:13 +00:00
'';
meta = with lib; {
homepage = "https://github.com/trizen/pipe-viewer";
description = "CLI+GUI YouTube Client";
license = licenses.artistic2;
maintainers = with maintainers; [ julm ];
platforms = platforms.all;
};
}