about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/text/teip/default.nix
blob: c0ac20a28149552e8b5263f42b1353ee319d8840 (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
{ lib
, rustPlatform
, fetchFromGitHub
, installShellFiles
, perl
, stdenv
}:

rustPlatform.buildRustPackage rec {
  pname = "teip";
  version = "2.3.0";

  src = fetchFromGitHub {
    owner = "greymd";
    repo = "teip";
    rev = "v${version}";
    hash = "sha256-09IKAM1ha40CvF5hdQIlUab7EBBFourC70LAagrs5+4=";
  };

  cargoHash = "sha256-cBFczgvLja6upuPnXphG2d9Rf1ZpNAVh16NHAHfXxHg=";

  nativeBuildInputs = [ installShellFiles ];

  nativeCheckInputs = [ perl ];

  # Cargo.lock is outdated
  preConfigure = ''
    cargo update --offline
  '';

  # tests are locale sensitive
  preCheck = ''
    export LANG=${if stdenv.isDarwin then "en_US.UTF-8" else "C.UTF-8"}
  '';

  postInstall = ''
    installManPage man/teip.1
    installShellCompletion \
      --bash completion/bash/teip \
      --fish completion/fish/teip.fish \
      --zsh completion/zsh/_teip
  '';

  meta = with lib; {
    description = "A tool to bypass a partial range of standard input to any command";
    homepage = "https://github.com/greymd/teip";
    changelog = "https://github.com/greymd/teip/releases/tag/v${version}";
    license = licenses.mit;
    maintainers = with maintainers; [ figsoda ];
  };
}