nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, fetchFromGitHub
3, python3
4}:
5
6python3.pkgs.buildPythonApplication rec {
7 pname = "homeassistant-cli";
8 version = "0.9.6";
9 format = "setuptools";
10
11 src = fetchFromGitHub {
12 owner = "home-assistant-ecosystem";
13 repo = "home-assistant-cli";
14 rev = version;
15 hash = "sha256-4OeHJ7icDZUOC5K4L0F0Nd9lbJPgdW4LCU0wniLvJ1Q=";
16 };
17
18 postPatch = ''
19 # Ignore pinned versions
20 sed -i "s/'\(.*\)\(==\|>=\).*'/'\1'/g" setup.py
21 '';
22
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 ];
36
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 #'';
46
47 nativeCheckInputs = with python3.pkgs; [
48 pytestCheckHook
49 requests-mock
50 ];
51
52 pythonImportsCheck = [
53 "homeassistant_cli"
54 ];
55
56 meta = with lib; {
57 description = "Command-line tool for Home Assistant";
58 homepage = "https://github.com/home-assistant-ecosystem/home-assistant-cli";
59 changelog = "https://github.com/home-assistant-ecosystem/home-assistant-cli/releases/tag/${version}";
60 license = licenses.asl20;
61 maintainers = teams.home-assistant.members;
62 };
63}