1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5 pythonOlder,
6 poetry-core,
7 poetry-dynamic-versioning,
8 installShellFiles,
9 pytestCheckHook,
10 requests-mock,
11 requests,
12 pydantic,
13 click,
14 appdirs,
15 stdenv,
16 nix-update-script,
17}:
18
19buildPythonPackage rec {
20 pname = "philipstv";
21 version = "2.1.1";
22 pyproject = true;
23
24 disabled = pythonOlder "3.9";
25
26 src = fetchFromGitHub {
27 owner = "bcyran";
28 repo = "philipstv";
29 tag = version;
30 hash = "sha256-BvQurZls9NjtHhTXLQ9t8fHkAF/QU/c6mmRvNmE0v90=";
31 };
32
33 build-system = [
34 poetry-core
35 poetry-dynamic-versioning
36 ];
37
38 nativeBuildInputs = [
39 installShellFiles
40 ];
41
42 dependencies = [
43 requests
44 pydantic
45 click
46 appdirs
47 ];
48
49 nativeCheckInputs = [
50 pytestCheckHook
51 requests-mock
52 ];
53
54 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
55 installShellCompletion --cmd philipstv \
56 --bash <(_PHILIPSTV_COMPLETE=bash_source $out/bin/philipstv) \
57 --zsh <(_PHILIPSTV_COMPLETE=zsh_source $out/bin/philipstv) \
58 --fish <(_PHILIPSTV_COMPLETE=fish_source $out/bin/philipstv)
59 '';
60
61 pythonImportsCheck = [ "philipstv" ];
62
63 passthru.updateScript = nix-update-script { };
64
65 meta = {
66 description = "CLI and library to control Philips Android-powered TVs";
67 homepage = "https://github.com/bcyran/philipstv";
68 changelog = "https://github.com/bcyran/philipstv/releases/tag/${version}";
69 license = lib.licenses.mit;
70 mainProgram = "philipstv";
71 maintainers = with lib.maintainers; [ bcyran ];
72 };
73}