Merge pull request #329823 from ExpidusOS/fix/pkgsllvm/elfutils
[NixPkgs.git] / pkgs / servers / home-assistant / cli.nix
blobb567cb0fe5365164efedc0145fa6d343cd968c2b
1 { lib
2 , fetchFromGitHub
3 , python3
4 }:
6 python3.pkgs.buildPythonApplication rec {
7   pname = "homeassistant-cli";
8   version = "0.9.6";
9   format = "setuptools";
11   src = fetchFromGitHub {
12     owner = "home-assistant-ecosystem";
13     repo = "home-assistant-cli";
14     rev = version;
15     hash = "sha256-4OeHJ7icDZUOC5K4L0F0Nd9lbJPgdW4LCU0wniLvJ1Q=";
16   };
18   postPatch = ''
19     # Ignore pinned versions
20     sed -i "s/'\(.*\)\(==\|>=\).*'/'\1'/g" setup.py
21   '';
23   propagatedBuildInputs = with python3.pkgs; [
24     aiohttp
25     click
26     click-log
27     dateparser
28     jinja2
29     jsonpath-ng
30     netdisco
31     regex
32     requests
33     ruamel-yaml
34     tabulate
35   ];
37   # TODO: Completion needs to be adapted after support for latest click was added
38   # $ source <(_HASS_CLI_COMPLETE=bash_source hass-cli) # for bash
39   # $ source <(_HASS_CLI_COMPLETE=zsh_source hass-cli)  # for zsh
40   # $ eval (_HASS_CLI_COMPLETE=fish_source hass-cli)    # for fish
41   #postInstall = ''
42   #  mkdir -p "$out/share/bash-completion/completions" "$out/share/zsh/site-functions"
43   #  $out/bin/hass-cli completion bash > "$out/share/bash-completion/completions/hass-cli"
44   #  $out/bin/hass-cli completion zsh > "$out/share/zsh/site-functions/_hass-cli"
45   #'';
47   nativeCheckInputs = with python3.pkgs; [
48     pytestCheckHook
49     requests-mock
50   ];
52   pythonImportsCheck = [
53     "homeassistant_cli"
54   ];
56   meta = with lib; {
57     description = "Command-line tool for Home Assistant";
58     mainProgram = "hass-cli";
59     homepage = "https://github.com/home-assistant-ecosystem/home-assistant-cli";
60     changelog = "https://github.com/home-assistant-ecosystem/home-assistant-cli/releases/tag/${version}";
61     license = licenses.asl20;
62     maintainers = teams.home-assistant.members;
63   };