@@ -1,4 +1,4 @@
1−{ lib, buildGoPackage, fetchFromGitHub }:
1+{ stdenv, lib, buildGoPackage, fetchFromGitHub }:
22
33buildGoPackage rec {
44 name = "stern-${version}";
@@ -15,11 +15,20 @@ buildGoPackage rec {
1515
1616 goDeps = ./deps.nix;
1717
18− meta = with lib; {
19− description = "Multi pod and container log tailing for Kubernetes";
20− homepage = "https://github.com/wercker/stern";
21− license = licenses.asl20;
22− maintainers = with maintainers; [ mbode ];
23− platforms = platforms.unix;
24− };
18+ # Only build shell completion if we're _not_ cross compiling,
19+ # because it requires executing the compiled stern binary.
20+ postInstall = lib.optionalString (stdenv.buildPlatform == stdenv.hostPlatform) ''
21+ mkdir -p $bin/share/bash-completion/completions
22+ $bin/bin/stern --completion bash > $bin/share/bash-completion/completions/stern
23+ mkdir -p $bin/share/zsh/site-functions
24+ $bin/bin/stern --completion zsh > $bin/share/zsh/site-functions/_stern
25+ '';
26+
27+ meta = with lib; {
28+ description = "Multi pod and container log tailing for Kubernetes";
29+ homepage = "https://github.com/wercker/stern";
30+ license = licenses.asl20;
31+ maintainers = with maintainers; [ mbode ];
32+ platforms = platforms.unix;
33+ };
2534}