Commit f2b7d7b9 authored by 06kellyjac's avatar 06kellyjac
Browse files

witness: provide completions for cross-compile

Already skipped to keep compatible with cross but now also
provide completions.
parent dd49e078
Loading
Loading
Loading
Loading
+18 −7
Original line number Diff line number Diff line
@@ -3,11 +3,14 @@
  stdenv,
  buildGoModule,
  fetchFromGitHub,
  installShellFiles,

  # testing
  testers,
  witness,

  installShellFiles,

  buildPackages,
}:

buildGoModule rec {
@@ -42,11 +45,19 @@ buildGoModule rec {
    unset ldflags
  '';

  postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
  postInstall =
    let
      exe =
        if stdenv.buildPlatform.canExecute stdenv.hostPlatform then
          "$out/bin/witness"
        else
          lib.getExe buildPackages.witness;
    in
    ''
      installShellCompletion --cmd witness \
      --bash <($out/bin/witness completion bash) \
      --fish <($out/bin/witness completion fish) \
      --zsh <($out/bin/witness completion zsh)
        --bash <(${exe} completion bash) \
        --fish <(${exe} completion fish) \
        --zsh <(${exe} completion zsh)
    '';

  passthru.tests.version = testers.testVersion {