summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/philipstv/default.nix
blob: 82ecfccb31309004911e905cf1fd33d872aa6881 (plain)
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
65
66
67
68
69
70
{
  lib,
  fetchFromGitHub,
  buildPythonPackage,
  poetry-core,
  poetry-dynamic-versioning,
  installShellFiles,
  pytestCheckHook,
  requests-mock,
  requests,
  pydantic,
  click,
  appdirs,
  stdenv,
  nix-update-script,
}:

buildPythonPackage rec {
  pname = "philipstv";
  version = "3.0.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "bcyran";
    repo = "philipstv";
    tag = version;
    hash = "sha256-9OlPaGruD6HDJArvIOb/pIVw5nqTUleDfxeYp2xBbEA=";
  };

  build-system = [
    poetry-core
    poetry-dynamic-versioning
  ];

  nativeBuildInputs = [
    installShellFiles
  ];

  dependencies = [
    requests
    pydantic
    click
    appdirs
  ];

  nativeCheckInputs = [
    pytestCheckHook
    requests-mock
  ];

  postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
    installShellCompletion --cmd philipstv \
      --bash <(_PHILIPSTV_COMPLETE=bash_source $out/bin/philipstv) \
      --zsh <(_PHILIPSTV_COMPLETE=zsh_source $out/bin/philipstv) \
      --fish <(_PHILIPSTV_COMPLETE=fish_source $out/bin/philipstv)
  '';

  pythonImportsCheck = [ "philipstv" ];

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

  meta = {
    description = "CLI and library to control Philips Android-powered TVs";
    homepage = "https://github.com/bcyran/philipstv";
    changelog = "https://github.com/bcyran/philipstv/releases/tag/${src.tag}";
    license = lib.licenses.mit;
    mainProgram = "philipstv";
    maintainers = with lib.maintainers; [ bcyran ];
  };
}