summary refs log tree commit diff
path: root/pkgs/tools/misc/audible-cli/default.nix
blob: e7f073451b5db6ba57eec7513d0a83aaf8f6f480 (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
52
53
54
55
56
57
58
59
60
61
62
63
{ lib, python3Packages, fetchFromGitHub, installShellFiles }:

python3Packages.buildPythonApplication rec {
  pname = "audible-cli";
  version = "0.2.5";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "mkb79";
    repo = "audible-cli";
    rev = "refs/tags/v${version}";
    hash = "sha256-YGvnye6YSp/H/2HAw6A8z5VzzCqa3ktJucq+3cXPUpc=";
  };

  nativeBuildInputs = with python3Packages; [
    pythonRelaxDepsHook
    setuptools
  ] ++ [
    installShellFiles
  ];

  propagatedBuildInputs = with python3Packages; [
    aiofiles
    audible
    click
    httpx
    packaging
    pillow
    questionary
    tabulate
    toml
    tqdm
  ];

  pythonRelaxDeps = [
    "httpx"
    "audible"
  ];

  postInstall = ''
    export PATH=$out/bin:$PATH
    installShellCompletion --cmd audible \
      --bash <(source utils/code_completion/audible-complete-bash.sh) \
      --fish <(source utils/code_completion/audible-complete-zsh-fish.sh) \
      --zsh <(source utils/code_completion/audible-complete-zsh-fish.sh)
  '';

  # upstream has no tests
  doCheck = false;

  pythonImportsCheck = [
    "audible_cli"
  ];

  meta = with lib; {
    description = "A command line interface for audible package. With the cli you can download your Audible books, cover, chapter files";
    license = licenses.agpl3Only;
    homepage = "https://github.com/mkb79/audible-cli";
    changelog = "https://github.com/mkb79/audible-cli/blob/${src.rev}/CHANGELOG.md";
    maintainers = with maintainers; [ jvanbruegge ];
    mainProgram = "audible";
  };
}