btrbk: add mainProgram (#356350)
[NixPkgs.git] / pkgs / by-name / li / little_boxes / package.nix
blobebc2da2e404ecb32c5bb889859f96cb3d7b3dd5e
1 { lib
2 , rustPlatform
3 , fetchFromGitHub
4 , installShellFiles
5 , testers
6 , little_boxes
7 }:
9 rustPlatform.buildRustPackage rec {
10   pname = "little_boxes";
11   version = "1.10.0";
13   src = fetchFromGitHub {
14     owner = "giodamelio";
15     repo = "little_boxes";
16     rev = version;
17     hash = "sha256-Quh09K5meiA39ih/orJWF2WfkuZdymxub1dZvns/q3E=";
18   };
20   cargoVendorDir = "vendor";
22   nativeBuildInputs = [ installShellFiles ];
24   postInstall = ''
25     extrasPath=$(ls -d $releaseDir/build/little_boxes-*/out/)
27     installManPage $extrasPath/little_boxes.1
28     installShellCompletion --bash $extrasPath/little_boxes.bash
29     installShellCompletion --fish $extrasPath/little_boxes.fish
30     installShellCompletion --zsh $extrasPath/_little_boxes
31   '';
33   passthru.tests.version = testers.testVersion {
34     package = little_boxes;
35     command = "little_boxes --version";
36   };
38   meta = with lib; {
39     description = "Add boxes are input text";
40     longDescription = ''
41       little_boxes is a small program that takes input from stdin or a file
42       and wraps it with box made of ACII/Unicode Box Drawing characters. There
43       are several different charsets and you can optionally add a title
45       Example:
47       $ echo "Hello World" | little_boxes
48       ┏━━━━━━━━━━━━━┓
49       ┃ Hello World ┃
50       ┗━━━━━━━━━━━━━┛
51     '';
52     homepage = "https://github.com/giodamelio/little_boxes";
53     license = licenses.mit;
54     maintainers = with maintainers; [ giodamelio ];
55     mainProgram = "little_boxes";
56   };