summary refs log tree commit diff
path: root/pkgs/tools/misc/ytarchive/default.nix
blob: 968a280dae8236e6a344cffc8468d0d1ec39c4fc (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
{ lib, buildGoModule, fetchFromGitHub, fetchpatch, makeBinaryWrapper, ffmpeg }:

buildGoModule rec {
  pname = "ytarchive";
  version = "0.3.2";

  src = fetchFromGitHub {
    owner = "Kethsar";
    repo = "ytarchive";
    rev = "v${version}";
    hash = "sha256-fBYwLGg1h5pn8ZP5vZmzzIEvuXlBJ27p4tv7UVMwOEw=";
  };

  patches = [
    # Increase the Go version required. See https://github.com/Kethsar/ytarchive/pull/127
    (fetchpatch {
      url = "https://github.com/Kethsar/ytarchive/commit/2a995ead4448d03c975378a1932ad975da1a6383.patch";
      sha256 = "sha256-Y+y/Sp/xOS9tBT+LQQ9vE+4n/2RH10umFEEEEVXgtuc=";
    })
  ];

  vendorHash = "sha256-8uTDcu8ucPzck+1dDoySGtc3l1+1USxCfUvdS+ncsnU=";

  nativeBuildInputs = [ makeBinaryWrapper ];

  ldflags = [ "-s" "-w" "-X main.Commit=-${src.rev}" ];

  postInstall = ''
    wrapProgram $out/bin/ytarchive --prefix PATH : ${lib.makeBinPath [ ffmpeg ]}
  '';

  meta = with lib; {
    homepage = "https://github.com/Kethsar/ytarchive";
    description = "Garbage Youtube livestream downloader";
    license = licenses.mit;
    maintainers = [ maintainers.marsam ];
  };
}