17 perlEnv = perl.withPackages (ps: with ps; [
34 ] ++ lib.optionals withGtk3 [
39 pname = "pipe-viewer";
42 src = fetchFromGitHub {
46 hash = "sha256-2Kzo7NYxARPFuOijwf2a3WQxnNumtKRiRhMhjrWA4GY=";
49 nativeBuildInputs = [ makeWrapper ]
50 ++ lib.optionals withGtk3 [ wrapGAppsHook ];
52 buildInputs = [ perlEnv ]
53 # Can't be in perlEnv for wrapGAppsHook to work correctly
54 ++ lib.optional withGtk3 Gtk3;
56 # Not supported by buildPerlModule
57 # and the Perl code fails anyway
58 # when Getopt::Long sets $gtk in Build.PL:
59 # 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.
60 #buildFlags = lib.optional withGtk3 "--gtk3";
61 postPatch = lib.optionalString withGtk3 ''
62 substituteInPlace Build.PL --replace 'my $gtk ' 'my $gtk = 1;#'
71 wrapProgram "$out/bin/pipe-viewer" \
72 --prefix PATH : "${lib.makeBinPath [ ffmpeg wget youtube-dl yt-dlp ]}"
73 '' + lib.optionalString withGtk3 ''
74 # make xdg-open overrideable at runtime
75 wrapProgram "$out/bin/gtk-pipe-viewer" ''${gappsWrapperArgs[@]} \
76 --prefix PATH : "${lib.makeBinPath [ ffmpeg wget youtube-dl yt-dlp ]}" \
77 --suffix PATH : "${lib.makeBinPath [ xdg-utils ]}"
81 homepage = "https://github.com/trizen/pipe-viewer";
82 description = "CLI+GUI YouTube Client";
83 license = licenses.artistic2;
84 maintainers = with maintainers; [ julm ];
85 platforms = platforms.all;