@@ -1,4 +1,4 @@
1−{ buildGoModule, fetchFromGitHub, lib, writeText }:
1+{ buildGoModule, fetchFromGitHub, stdenv, lib, writeText }:
22
33buildGoModule rec {
44 pname = "fly";
@@ -20,12 +20,10 @@ buildGoModule rec {
2020 -X github.com/concourse/concourse.Version=${version}
2121 '';
2222
23− # The fly.bash file included with this derivation can be replaced by a
24− # call to `fly completion bash` once the `completion` subcommand has
25− # made it into a release. Similarly, `fly completion zsh` will provide
26− # zsh completions. https://github.com/concourse/concourse/pull/4012
27− postInstall = ''
28− install -D -m 444 ${./fly.bash} $out/share/bash-completion/completions/fly
23+ postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
24+ mkdir -p $out/share/{bash-completion/completions,zsh/site-functions}
25+ $out/bin/fly completion --shell bash > $out/share/bash-completion/completions/fly
26+ $out/bin/fly completion --shell zsh > $out/share/zsh/site-functions/_fly
2927 '';
3028
3129 meta = with lib; {