summary refs log tree commit diff
path: root/pkgs/tools/misc/autorandr
diff options
context:
space:
mode:
authorAnund <anundm@gmail.com>2021-12-05 18:07:39 +1100
committerAnund <anundm@gmail.com>2021-12-05 19:46:52 +1100
commitbdda2cca74af24138fce810216d1f4c91e6eb13e (patch)
treee2c102f1c77a04cf89830695770b4b63cb825a6e /pkgs/tools/misc/autorandr
parent1421e6be620117a74b162aa1fe38fcbb2cdc56a2 (diff)
downloadnixpkgs-bdda2cca74af24138fce810216d1f4c91e6eb13e.tar
nixpkgs-bdda2cca74af24138fce810216d1f4c91e6eb13e.tar.gz
nixpkgs-bdda2cca74af24138fce810216d1f4c91e6eb13e.tar.bz2
nixpkgs-bdda2cca74af24138fce810216d1f4c91e6eb13e.tar.lz
nixpkgs-bdda2cca74af24138fce810216d1f4c91e6eb13e.tar.xz
nixpkgs-bdda2cca74af24138fce810216d1f4c91e6eb13e.tar.zst
nixpkgs-bdda2cca74af24138fce810216d1f4c91e6eb13e.zip
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
Diffstat (limited to 'pkgs/tools/misc/autorandr')
-rw-r--r--pkgs/tools/misc/autorandr/default.nix12
1 files changed, 10 insertions, 2 deletions
diff --git a/pkgs/tools/misc/autorandr/default.nix b/pkgs/tools/misc/autorandr/default.nix
index 79320401454..7b044fd0dd9 100644
--- a/pkgs/tools/misc/autorandr/default.nix
+++ b/pkgs/tools/misc/autorandr/default.nix
@@ -2,7 +2,8 @@
 , python3Packages
 , fetchFromGitHub
 , systemd
-, xrandr }:
+, xrandr
+, installShellFiles }:
 
 stdenv.mkDerivation rec {
   pname = "autorandr";
@@ -10,6 +11,8 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ python3Packages.python ];
 
+  nativeBuildInputs = [ installShellFiles ];
+
   # no wrapper, as autorandr --batch does os.environ.clear()
   buildPhase = ''
     substituteInPlace autorandr.py \
@@ -23,7 +26,12 @@ stdenv.mkDerivation rec {
     runHook preInstall
     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