nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 buildGoModule,
4 fetchFromGitHub,
5 installShellFiles,
6 lib,
7 testers,
8 twitch-cli,
9}:
10
11buildGoModule rec {
12 pname = "twitch-cli";
13 version = "1.1.25";
14
15 src = fetchFromGitHub {
16 owner = "twitchdev";
17 repo = "twitch-cli";
18 rev = "v${version}";
19 hash = "sha256-+6/o2vhj1iaT0hkyQRedn7ga1dhNZOupX4lOadnTDU0=";
20 };
21
22 patches = [
23 ./application-name.patch
24 ];
25
26 vendorHash = "sha256-LPpUnielSeGE0k68z+M565IqXQUIkAh5xloOqcbfh20=";
27
28 ldflags = [
29 "-s"
30 "-w"
31 "-X=main.buildVersion=${version}"
32 ];
33
34 preCheck = ''
35 export HOME=$(mktemp -d)
36 '';
37
38 nativeBuildInputs = [ installShellFiles ];
39
40 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
41 $out/bin/twitch-cli completion bash > twitch-cli.bash
42 $out/bin/twitch-cli completion fish > twitch-cli.fish
43 $out/bin/twitch-cli completion zsh > _twitch-cli
44 installShellCompletion --cmd twitch-cli \
45 --bash twitch-cli.bash \
46 --fish twitch-cli.fish \
47 --zsh _twitch-cli
48 '';
49
50 __darwinAllowLocalNetworking = true;
51
52 passthru.tests.version = testers.testVersion {
53 package = twitch-cli;
54 command = "HOME=$(mktemp -d) twitch-cli version";
55 version = "twitch-cli/${version}";
56 };
57
58 meta = {
59 description = "Official Twitch CLI to make developing on Twitch easier";
60 mainProgram = "twitch-cli";
61 homepage = "https://github.com/twitchdev/twitch-cli";
62 license = lib.licenses.asl20;
63 maintainers = with lib.maintainers; [ benediktbroich ];
64 };
65}