about summary refs log tree commit diff
path: root/pkgs/tools/misc/onefetch/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/misc/onefetch/default.nix')
-rw-r--r--pkgs/tools/misc/onefetch/default.nix11
1 files changed, 10 insertions, 1 deletions
diff --git a/pkgs/tools/misc/onefetch/default.nix b/pkgs/tools/misc/onefetch/default.nix
index 1792dd588f0eb..8311290feb848 100644
--- a/pkgs/tools/misc/onefetch/default.nix
+++ b/pkgs/tools/misc/onefetch/default.nix
@@ -2,6 +2,7 @@
 , rustPlatform
 , fetchFromGitHub
 , cmake
+, installShellFiles
 , pkg-config
 , zstd
 , stdenv
@@ -29,7 +30,7 @@ rustPlatform.buildRustPackage rec {
     ./zstd-pkg-config.patch
   ];
 
-  nativeBuildInputs = [ cmake pkg-config ];
+  nativeBuildInputs = [ cmake installShellFiles pkg-config ];
 
   buildInputs = [ zstd ]
     ++ lib.optionals stdenv.isDarwin [ CoreFoundation libresolv Security ];
@@ -40,11 +41,19 @@ rustPlatform.buildRustPackage rec {
 
   preCheck = ''
     git init
+    git config user.name nixbld
     git config user.email nixbld@example.com
     git add .
     git commit -m test
   '';
 
+  postInstall = ''
+    installShellCompletion --cmd onefetch \
+      --bash <($out/bin/onefetch --generate bash) \
+      --fish <($out/bin/onefetch --generate fish) \
+      --zsh <($out/bin/onefetch --generate zsh)
+  '';
+
   meta = with lib; {
     description = "Git repository summary on your terminal";
     homepage = "https://github.com/o2sh/onefetch";