summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/servers/home-assistant/cli.nix16
1 files changed, 14 insertions, 2 deletions
diff --git a/pkgs/servers/home-assistant/cli.nix b/pkgs/servers/home-assistant/cli.nix
index fff804d53a1..90e4b0c736d 100644
--- a/pkgs/servers/home-assistant/cli.nix
+++ b/pkgs/servers/home-assistant/cli.nix
@@ -15,16 +15,28 @@ python36.pkgs.buildPythonApplication rec {
     sed -i "s/'\(.*\)\(==\|>=\).*'/'\1'/g" setup.py
   '';
 
+  nativeBuildInputs = [
+    glibcLocales
+  ];
+
   propagatedBuildInputs = with python36.pkgs; [
     requests pyyaml netdisco click click-log tabulate idna jsonpath_rw jinja2 dateparser
   ];
 
+  LC_ALL = "en_US.UTF-8";
+
+  postInstall = ''
+    mkdir -p "$out/share/bash-completion/completions" "$out/share/zsh/site-functions"
+    $out/bin/hass-cli completion bash > "$out/share/bash-completion/completions/hass-cli"
+    $out/bin/hass-cli completion zsh > "$out/share/zsh/site-functions/_hass-cli"
+  '';
+
   checkInputs = with python36.pkgs; [
-    pytest requests-mock glibcLocales
+    pytest requests-mock
   ];
 
   checkPhase = ''
-    LC_ALL=en_US.UTF-8 pytest
+    pytest
   '';
 
   meta = with lib; {