nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 rustPlatform,
6 installShellFiles,
7
8}:
9
10rustPlatform.buildRustPackage rec {
11 pname = "bandwhich";
12 version = "0.23.1";
13
14 src = fetchFromGitHub {
15 owner = "imsnif";
16 repo = "bandwhich";
17 rev = "v${version}";
18 hash = "sha256-gXPX5drVXsfkssPMdhqIpFsYNSbelE9mKwO+nGEy4Qs=";
19 };
20
21 cargoHash = "sha256-bsyEEbwBTDcIOc+PRkZqcfqcDgQnchuVy8a8eSZZUHU=";
22
23 nativeBuildInputs = [ installShellFiles ];
24
25 __darwinAllowLocalNetworking = true;
26
27 preConfigure = ''
28 export BANDWHICH_GEN_DIR=_shell-files
29 mkdir -p $BANDWHICH_GEN_DIR
30 '';
31
32 postInstall = ''
33 installManPage $BANDWHICH_GEN_DIR/bandwhich.1
34
35 installShellCompletion $BANDWHICH_GEN_DIR/bandwhich.{bash,fish} \
36 --zsh $BANDWHICH_GEN_DIR/_bandwhich
37 '';
38
39 meta = {
40 description = "CLI utility for displaying current network utilization";
41 longDescription = ''
42 bandwhich sniffs a given network interface and records IP packet size, cross
43 referencing it with the /proc filesystem on linux or lsof on MacOS. It is
44 responsive to the terminal window size, displaying less info if there is
45 no room for it. It will also attempt to resolve ips to their host name in
46 the background using reverse DNS on a best effort basis.
47 '';
48 homepage = "https://github.com/imsnif/bandwhich";
49 changelog = "https://github.com/imsnif/bandwhich/blob/${src.rev}/CHANGELOG.md";
50 license = lib.licenses.mit;
51 maintainers = [
52 ];
53 platforms = lib.platforms.unix;
54 mainProgram = "bandwhich";
55 };
56}