From f939fcebbafb83070b5f93de6dd1055e0ae8d977 Mon Sep 17 00:00:00 2001 From: Artur Sannikov Date: Thu, 9 Jul 2026 11:48:05 +0300 Subject: [PATCH] dua: add shell completions --- pkgs/by-name/du/dua/package.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkgs/by-name/du/dua/package.nix b/pkgs/by-name/du/dua/package.nix index 98373690e108..60685251dcf5 100644 --- a/pkgs/by-name/du/dua/package.nix +++ b/pkgs/by-name/du/dua/package.nix @@ -1,9 +1,11 @@ { + stdenv, lib, rustPlatform, fetchFromGitHub, versionCheckHook, nix-update-script, + installShellFiles, }: rustPlatform.buildRustPackage (finalAttrs: { @@ -38,6 +40,16 @@ rustPlatform.buildRustPackage (finalAttrs: { nativeInstallCheckInputs = [ versionCheckHook ]; doInstallCheck = true; + nativeBuildInputs = [ installShellFiles ]; + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + # TODO: Upstream also provides Elvish and PowerShell completions, + # but `installShellCompletion` only has support for Bash, Zsh and Fish at the moment. + installShellCompletion --cmd dua \ + --bash <($out/bin/dua completions bash) \ + --fish <($out/bin/dua completions fish) \ + --zsh <($out/bin/dua completions zsh) + ''; + passthru.updateScript = nix-update-script { }; meta = {