diff --git a/pkgs/by-name/dp/dprint/package.nix b/pkgs/by-name/dp/dprint/package.nix index 5cf6abe3633c..6cfb7183c78e 100644 --- a/pkgs/by-name/dp/dprint/package.nix +++ b/pkgs/by-name/dp/dprint/package.nix @@ -3,6 +3,7 @@ stdenv, fetchCrate, rustPlatform, + installShellFiles, testers, nix-update-script, dprint, @@ -23,6 +24,18 @@ rustPlatform.buildRustPackage rec { # every commit upstream on GitHub Actions doCheck = false; + nativeBuildInputs = lib.optionals (stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + installShellFiles + ]; + + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + export DPRINT_CACHE_DIR="$(mktemp -d)" + installShellCompletion --cmd dprint \ + --bash <($out/bin/dprint completions bash) \ + --zsh <($out/bin/dprint completions zsh) \ + --fish <($out/bin/dprint completions fish) + ''; + passthru = { tests.version = testers.testVersion { inherit version;