about summary refs log tree commit diff
path: root/pkgs/by-name/qr/qrtool/package.nix
blob: 31bc57b89ee3c76480ee8512e1114c8206c824f2 (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
{ lib
, stdenv
, fetchFromGitHub
, rustPlatform
, asciidoctor
, installShellFiles
}: let
  name = "qrtool";
  version = "0.8.5";
in rustPlatform.buildRustPackage {
  pname = name;
  inherit version;

  src = fetchFromGitHub {
    owner = "sorairolake";
    repo = name;
    rev = "v${version}";
    sha256 = "sha256-jrvNZGO1VIDo6Mz3NKda1C7qZUtF9T00CAFK8yoGWjc=";
  };

  cargoSha256 = "sha256-JOnvlabCr3fZsIIRc2qTjf50Ga83zL8Aoo2sqzMBs7g=";

  nativeBuildInputs = [ asciidoctor installShellFiles ];

  postInstall = ''
    # Built by ./build.rs using `asciidoctor`
    installManPage ./target/*/release/build/${name}*/out/*.?

    installShellCompletion --cmd ${name} \
      --bash <($out/bin/${name} --generate-completion bash) \
      --fish <($out/bin/${name} --generate-completion fish) \
      --zsh <($out/bin/${name} --generate-completion zsh)
  '';

  meta = with lib; {
    maintainers = with maintainers; [ philiptaron ];
    description = "An utility for encoding or decoding QR code";
    license = licenses.asl20;
    homepage = "https://sorairolake.github.io/${name}/book/index.html";
    changelog = "https://sorairolake.github.io/${name}/book/changelog.html";
    mainProgram = name;
  };
}