autorandr: install zsh completions

autorandr includes functional zsh completions upstream they just lack
a make target to install the relevant file. For some consistency use the
direct file for both zsh and bash rather than just zsh. Note this
changes the resulting bash completion filename from just 'autorandr' to
'autorandr.bash'

See https://github.com/phillipberndt/autorandr/issues/197
This commit is contained in:
Anund 2021-12-05 18:07:39 +11:00
parent 1421e6be62
commit bdda2cca74

View File

@ -2,7 +2,8 @@
, python3Packages , python3Packages
, fetchFromGitHub , fetchFromGitHub
, systemd , systemd
, xrandr }: , xrandr
, installShellFiles }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "autorandr"; pname = "autorandr";
@ -10,6 +11,8 @@ stdenv.mkDerivation rec {
buildInputs = [ python3Packages.python ]; buildInputs = [ python3Packages.python ];
nativeBuildInputs = [ installShellFiles ];
# no wrapper, as autorandr --batch does os.environ.clear() # no wrapper, as autorandr --batch does os.environ.clear()
buildPhase = '' buildPhase = ''
substituteInPlace autorandr.py \ substituteInPlace autorandr.py \
@ -23,7 +26,12 @@ stdenv.mkDerivation rec {
runHook preInstall runHook preInstall
make install TARGETS='autorandr' PREFIX=$out make install TARGETS='autorandr' PREFIX=$out
make install TARGETS='bash_completion' DESTDIR=$out/share/bash-completion/completions # zsh completions exist but currently have no make target, use
# installShellCompletions for both
# see https://github.com/phillipberndt/autorandr/issues/197
installShellCompletion --cmd autorandr \
--bash contrib/bash_completion/autorandr \
--zsh contrib/zsh_completion/_autorandr
make install TARGETS='autostart_config' PREFIX=$out DESTDIR=$out make install TARGETS='autostart_config' PREFIX=$out DESTDIR=$out