Commit 45087e16 authored by John Garcia's avatar John Garcia
Browse files

apx: install shell completions

parent a35fac79
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
  fetchFromGitHub,
  installShellFiles,
  distrobox,
  podman,
}:

buildGoModule rec {
@@ -19,7 +20,8 @@ buildGoModule rec {

  vendorHash = "sha256-hGi+M5RRUL2oyxFGVeR0sum93/CA+FGYy0m4vDmlXTc=";

  nativeBuildInputs = [ installShellFiles ];
  # podman needed for apx to not error when building shell completions
  nativeBuildInputs = [ installShellFiles podman ];

  ldflags = [ "-s" "-w" ];

@@ -36,6 +38,15 @@ buildGoModule rec {
    installManPage man/man1/*
    install -Dm444 README.md -t $out/share/docs/apx
    install -Dm444 COPYING.md $out/share/licenses/apx/LICENSE

    # Create a temp writable home-dir so apx outputs completions without error
    export HOME=$(mktemp -d)
    # apx command now works (for completions)
    # though complains "Error: no such file or directory"
    installShellCompletion --cmd apx \
      --bash <($out/bin/apx completion bash) \
      --fish <($out/bin/apx completion fish) \
      --zsh <($out/bin/apx completion zsh)
  '';

  meta = with lib; {