about summary refs log tree commit diff
path: root/pkgs/by-name/au/audible-cli/package.nix
blob: b0026fef46419594fedda7188f52dd72c921d22a (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
64
{ lib, python3Packages, fetchFromGitHub, installShellFiles, nix-update-script }:

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

  src = fetchFromGitHub {
    owner = "mkb79";
    repo = "audible-cli";
    rev = "refs/tags/v${version}";
    hash = "sha256-AYL7lcYYY7gK12Id94aHRWRlCiznnF4r+lpI5VFpAWY=";
  };

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

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

  pythonRelaxDeps = [
    "httpx"
  ];

  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"
  ];

  passthru.updateScript = nix-update-script { };

  meta = with lib; {
    description = "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";
  };
}