From 3d4ea13cbe1ba36dffa6568a2c6d4c669b5c2670 Mon Sep 17 00:00:00 2001 From: Matthieu Coudron <886074+teto@users.noreply.github.com> Date: Wed, 14 Feb 2024 11:07:20 +0100 Subject: [PATCH] luarocks: add luarocks-admin completion --- .../development/tools/misc/luarocks/default.nix | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/pkgs/development/tools/misc/luarocks/default.nix b/pkgs/development/tools/misc/luarocks/default.nix index c8d36a1e3313..a446fb0b41f3 100644 --- a/pkgs/development/tools/misc/luarocks/default.nix +++ b/pkgs/development/tools/misc/luarocks/default.nix @@ -67,7 +67,19 @@ stdenv.mkDerivation (finalAttrs: { sed -e "1s@.*@#! ${lua}/bin/lua$LUA_SUFFIX@" -i "$out"/bin/* substituteInPlace $out/etc/luarocks/* \ --replace '${lua.luaOnBuild}' '${lua}' + '' + + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + installShellCompletion --cmd luarocks \ + --bash <($out/bin/luarocks completion bash) \ + --fish <($out/bin/luarocks completion fish) \ + --zsh <($out/bin/luarocks completion zsh) + installShellCompletion --cmd luarocks-admin \ + --bash <($out/bin/luarocks-admin completion bash) \ + --fish <($out/bin/luarocks-admin completion fish) \ + --zsh <($out/bin/luarocks-admin completion zsh) + '' + + '' for i in "$out"/bin/*; do test -L "$i" || { wrapProgram "$i" \ @@ -79,11 +91,6 @@ stdenv.mkDerivation (finalAttrs: { lib.optionals (finalAttrs.pname == "luarocks-nix") [ file nix-prefetch-git ])} } done - '' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' - installShellCompletion --cmd luarocks \ - --bash <($out/bin/luarocks completion bash) \ - --fish <($out/bin/luarocks completion fish) \ - --zsh <($out/bin/luarocks completion zsh) ''; propagatedBuildInputs = [ zip unzip cmake ];