From a0c8d18eb8d35e718dd4a2799ba3d27afa0bb8ee Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Mon, 8 Jul 2024 11:10:01 +0200 Subject: [PATCH 1/2] ov: fix shell completions --- pkgs/tools/text/ov/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/text/ov/default.nix b/pkgs/tools/text/ov/default.nix index c7801348c4e37..2099fd0eb8772 100644 --- a/pkgs/tools/text/ov/default.nix +++ b/pkgs/tools/text/ov/default.nix @@ -40,9 +40,9 @@ buildGoModule rec { postInstall = '' installShellCompletion --cmd ov \ - --bash <($out/bin/ov completion bash) \ - --fish <($out/bin/ov completion fish) \ - --zsh <($out/bin/ov completion zsh) + --bash <($out/bin/ov --completion bash) \ + --fish <($out/bin/ov --completion fish) \ + --zsh <($out/bin/ov --completion zsh) mkdir -p $out/share/$name cp $src/ov-less.yaml $out/share/$name/less-config.yaml From 6ece1873f03836263cbd816fa53bd891bc252349 Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Mon, 8 Jul 2024 11:11:06 +0200 Subject: [PATCH 2/2] ov: only generate completions if executable can be run This fixes cross builds. --- pkgs/tools/text/ov/default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/text/ov/default.nix b/pkgs/tools/text/ov/default.nix index 2099fd0eb8772..1556eeabe366c 100644 --- a/pkgs/tools/text/ov/default.nix +++ b/pkgs/tools/text/ov/default.nix @@ -1,4 +1,5 @@ { lib +, stdenv , buildGoModule , fetchFromGitHub , installShellFiles @@ -38,12 +39,12 @@ buildGoModule rec { outputs = [ "out" "doc" ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd ov \ --bash <($out/bin/ov --completion bash) \ --fish <($out/bin/ov --completion fish) \ --zsh <($out/bin/ov --completion zsh) - + '' + '' mkdir -p $out/share/$name cp $src/ov-less.yaml $out/share/$name/less-config.yaml makeWrapper $out/bin/ov $out/bin/ov-less --add-flags "--config $out/share/$name/less-config.yaml"