docker: use new completions

The completions were taken from https://github.com/docker/cli/tree/master/contrib/completion

Looking at recent PRs, it looks like these files are no longer being updated and instead everything is based on `docker completion`.

This is consistent with the manual: https://github.com/docker/docs/blob/main/content/manuals/engine/cli/completion.md

Co-authored-by: Tillmann Gaida <tillmann.gaida@gmail.com>
This commit is contained in:
teutat3s
2025-06-16 14:20:18 +02:00
co-authored by Tillmann Gaida
parent c1da900e73
commit 40d5a353e8
@@ -315,6 +315,8 @@ rec {
installPhase =
''
runHook preInstall
install -Dm755 ./build/docker $out/libexec/docker/docker
makeWrapper $out/libexec/docker/docker $out/bin/docker \
@@ -330,11 +332,16 @@ rec {
ln -s ${moby}/etc/systemd/system/docker.service $out/etc/systemd/system/docker.service
ln -s ${moby}/etc/systemd/system/docker.socket $out/etc/systemd/system/docker.socket
''
+ ''
# Required to avoid breaking cross builds
+ lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
# completion (cli)
installShellCompletion --bash ./contrib/completion/bash/docker
installShellCompletion --fish ./contrib/completion/fish/docker.fish
installShellCompletion --zsh ./contrib/completion/zsh/_docker
installShellCompletion --cmd docker \
--bash <($out/bin/docker completion bash) \
--fish <($out/bin/docker completion fish) \
--zsh <($out/bin/docker completion zsh)
''
+ ''
runHook postInstall
'';
passthru = {