summary refs log tree commit diff
path: root/pkgs/tools/misc/audible-cli/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/misc/audible-cli/default.nix')
-rw-r--r--pkgs/tools/misc/audible-cli/default.nix55
1 files changed, 45 insertions, 10 deletions
diff --git a/pkgs/tools/misc/audible-cli/default.nix b/pkgs/tools/misc/audible-cli/default.nix
index f83a87a75b2..e7f073451b5 100644
--- a/pkgs/tools/misc/audible-cli/default.nix
+++ b/pkgs/tools/misc/audible-cli/default.nix
@@ -1,28 +1,63 @@
-{ lib, python3Packages, fetchFromGitHub }:
+{ lib, python3Packages, fetchFromGitHub, installShellFiles }:
 
 python3Packages.buildPythonApplication rec {
   pname = "audible-cli";
-  version = "0.2.4";
+  version = "0.2.5";
+  pyproject = true;
 
   src = fetchFromGitHub {
     owner = "mkb79";
-    repo = pname;
+    repo = "audible-cli";
     rev = "refs/tags/v${version}";
-    sha256 = "sha256-umIPHKPfWKlzEVyRKbBqmul/8n13EnpfYXmSQbQtLq8=";
+    hash = "sha256-YGvnye6YSp/H/2HAw6A8z5VzzCqa3ktJucq+3cXPUpc=";
   };
 
-  propagatedBuildInputs = with python3Packages; [ aiofiles audible click httpx pillow tabulate toml tqdm packaging setuptools questionary ];
+  nativeBuildInputs = with python3Packages; [
+    pythonRelaxDepsHook
+    setuptools
+  ] ++ [
+    installShellFiles
+  ];
 
-  postPatch = ''
-    substituteInPlace setup.py \
-      --replace "httpx>=0.20.0,<0.24.0" "httpx" \
-      --replace "audible>=0.8.2" "audible"
+  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.agpl3;
+    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";
   };
 }