about summary refs log tree commit diff
path: root/pkgs/development/compilers/dotnet/common.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/dotnet/common.nix')
-rw-r--r--pkgs/development/compilers/dotnet/common.nix11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkgs/development/compilers/dotnet/common.nix b/pkgs/development/compilers/dotnet/common.nix
index 63b3a7de374ef..e88ddfb3e37f1 100644
--- a/pkgs/development/compilers/dotnet/common.nix
+++ b/pkgs/development/compilers/dotnet/common.nix
@@ -6,6 +6,7 @@
 , runCommand
 , expect
 , curl
+, installShellFiles
 }: type: args: stdenv.mkDerivation (finalAttrs: args // {
   doInstallCheck = true;
 
@@ -27,6 +28,16 @@
     export DOTNET_SKIP_WORKLOAD_INTEGRITY_CHECK=1 # Skip integrity check on first run, which fails due to read-only directory
   '' + args.setupHook or "");
 
+  nativeBuildInputs = (args.nativeBuildInputs or []) ++ [ installShellFiles ];
+
+  postInstall = ''
+    # completions snippets taken from https://learn.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete
+    installShellCompletion --cmd dotnet \
+      --bash ${./completions/dotnet.bash} \
+      --zsh ${./completions/dotnet.zsh} \
+      --fish ${./completions/dotnet.fish}
+  '';
+
 } // lib.optionalAttrs (type == "sdk") {
   passthru = {
     tests = let