about summary refs log tree commit diff
path: root/nixos/modules/programs
diff options
context:
space:
mode:
authorProminentRetail <me@jakepark.me>2023-11-08 01:14:11 +1100
committerMaciej Krüger <mkg20001@gmail.com>2023-11-24 20:38:16 +0100
commit2db2f446c27b7be976822cf4d502857a0f522b2f (patch)
tree4099b8c48c433896441c92ff7eb0fc5a3b2a0082 /nixos/modules/programs
parentb2063364e120e14ea5a120bd144ab75a1a3b83f5 (diff)
nixos/git: add prompt.enable
Diffstat (limited to 'nixos/modules/programs')
-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 4e271a8c134b2..710dee349d590 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 ];