Skip to content

Commit

Permalink
esphome: install shell completion
Browse files Browse the repository at this point in the history
  • Loading branch information
pedorich-n committed Dec 26, 2023
1 parent 5aaec0c commit 36111f0
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions pkgs/tools/misc/esphome/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
, callPackage
, python3Packages
, fetchFromGitHub
, installShellFiles
, platformio
, esptool
, git
Expand All @@ -10,7 +11,7 @@
let
python = python3Packages.python.override {
packageOverrides = self: super: {
esphome-dashboard = self.callPackage ./dashboard.nix {};
esphome-dashboard = self.callPackage ./dashboard.nix { };
};
};
in
Expand All @@ -28,6 +29,8 @@ python.pkgs.buildPythonApplication rec {

nativeBuildInputs = with python.pkgs; [
setuptools
argcomplete
installShellFiles
];

postPatch = ''
Expand Down Expand Up @@ -97,9 +100,20 @@ python.pkgs.buildPythonApplication rec {
$out/bin/esphome --help > /dev/null
'';

postInstall =
let
argcomplete = lib.getExe' python3Packages.argcomplete "register-python-argcomplete";
in
''
installShellCompletion --cmd esphome \
--bash <(${argcomplete} --shell bash esphome) \
--zsh <(${argcomplete} --shell zsh esphome) \
--fish <(${argcomplete} --shell fish esphome)
'';

passthru = {
dashboard = python.pkgs.esphome-dashboard;
updateScript = callPackage ./update.nix {};
updateScript = callPackage ./update.nix { };
};

meta = with lib; {
Expand Down

0 comments on commit 36111f0

Please sign in to comment.