about summary refs log tree commit diff
path: root/pkgs/applications/video/pipe-viewer
diff options
context:
space:
mode:
authorJulien Moutinho <julm+nixpkgs@sourcephile.fr>2021-08-31 11:13:13 +0200
committerJulien Moutinho <julm+nixpkgs@sourcephile.fr>2021-09-21 16:29:28 +0200
commit6b960506f789d649c6b5783688cac9345272f27c (patch)
tree10fa0dadee20c2a336db74b6c6e6a55583d662d9 /pkgs/applications/video/pipe-viewer
parent99b632dbf8af6a91cfb3e56dda46ad9317cc4804 (diff)
downloadnixlib-6b960506f789d649c6b5783688cac9345272f27c.tar
nixlib-6b960506f789d649c6b5783688cac9345272f27c.tar.gz
nixlib-6b960506f789d649c6b5783688cac9345272f27c.tar.bz2
nixlib-6b960506f789d649c6b5783688cac9345272f27c.tar.lz
nixlib-6b960506f789d649c6b5783688cac9345272f27c.tar.xz
nixlib-6b960506f789d649c6b5783688cac9345272f27c.tar.zst
nixlib-6b960506f789d649c6b5783688cac9345272f27c.zip
pipe-viewer: init at 0.1.4
Diffstat (limited to 'pkgs/applications/video/pipe-viewer')
-rw-r--r--pkgs/applications/video/pipe-viewer/default.nix86
1 files changed, 86 insertions, 0 deletions
diff --git a/pkgs/applications/video/pipe-viewer/default.nix b/pkgs/applications/video/pipe-viewer/default.nix
new file mode 100644
index 000000000000..1ef08870c86a
--- /dev/null
+++ b/pkgs/applications/video/pipe-viewer/default.nix
@@ -0,0 +1,86 @@
+{ lib
+, fetchFromGitHub
+, perl
+, buildPerlModule
+, makeWrapper
+, wrapGAppsHook
+, withGtk3 ? false
+, ffmpeg
+, gtk3
+, 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";
+  version = "0.1.4";
+
+  src = fetchFromGitHub {
+    owner = "trizen";
+    repo = "pipe-viewer";
+    rev = version;
+    hash = "sha256-kDlZ3Cl8zvN/naGExh2yVW5yHwc1O04x4s22lNkbCzU=";
+  };
+
+  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 ''
+    wrapProgram "$out/bin/gtk-pipe-viewer" ''${gappsWrapperArgs[@]} \
+      --prefix PATH : "${lib.makeBinPath [ ffmpeg wget xdg-utils youtube-dl yt-dlp ]}"
+  '';
+
+  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;
+  };
+}