about summary refs log tree commit diff
path: root/nixos/modules/programs/git.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/programs/git.nix')
-rw-r--r--nixos/modules/programs/git.nix9
1 files changed, 9 insertions, 0 deletions
diff --git a/nixos/modules/programs/git.nix b/nixos/modules/programs/git.nix
index 4e271a8c134b..710dee349d59 100644
--- a/nixos/modules/programs/git.nix
+++ b/nixos/modules/programs/git.nix
@@ -58,6 +58,10 @@ in
         '';
       };
 
+      prompt = {
+        enable = mkEnableOption "automatically sourcing git-prompt.sh. This does not change $PS1; it simply provides relevant utility functions";
+      };
+
       lfs = {
         enable = mkEnableOption (lib.mdDoc "git-lfs");
 
@@ -89,6 +93,11 @@ in
         };
       };
     })
+    (mkIf (cfg.enable && cfg.prompt.enable) {
+      environment.interactiveShellInit = ''
+        source ${cfg.package}/share/bash-completion/completions/git-prompt.sh
+      '';
+    })
   ];
 
   meta.maintainers = with maintainers; [ figsoda ];