nixpkgs/pkgs/tools/misc/audible-cli/default.nix
natsukium ab47bc4dd7
audible-cli: refactor
- adopt `pyproject = true`
- use pythonRelaxDepsHook
- enable shell completions
- update license
- add changelog to meta
- add mainProgram to meta
2023-10-18 19:43:37 +09:00

63 lines
1.5 KiB
Nix

{ 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";
};
}