about summary refs log tree commit diff
path: root/pkgs/applications/file-managers/lf/ctpv.nix
blob: d1e4a6633730b76528bc66f818d8121df1192d49 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{ lib
, stdenv
, fetchFromGitHub
, makeWrapper
, file
, openssl
, atool
, bat
, chafa
, delta
, ffmpeg
, ffmpegthumbnailer
, fontforge
, glow
, imagemagick
, jq
, ueberzug
}:

stdenv.mkDerivation rec {
  pname = "ctpv";
  version = "1.1";

  src = fetchFromGitHub {
    owner = "NikitaIvanovV";
    repo = pname;
    rev = "v${version}";
    hash = "sha256-3BQi4m44hBmPkJBFNCg6d9YKRbDZwLxdzBb/NDWTQP4=";
  };

  nativeBuildInputs = [ makeWrapper ];

  buildInputs = [
    file # libmagic
    openssl
  ];

  makeFlags = [ "PREFIX=$(out)" ];

  preFixup = ''
    wrapProgram $out/bin/ctpv \
      --prefix PATH ":" "${lib.makeBinPath [
        atool # for archive files
        bat
        chafa # for image files on Wayland
        delta # for diff files
        ffmpeg
        ffmpegthumbnailer
        fontforge
        glow # for markdown files
        imagemagick
        jq # for json files
        ueberzug # for image files on X11
      ]}";
  '';

  meta = with lib; {
    description = "File previewer for a terminal";
    homepage = "https://github.com/NikitaIvanovV/ctpv";
    license = licenses.mit;
    platforms = platforms.linux;
    maintainers = [ maintainers.wesleyjrz ];
  };
}