aboutsummaryrefslogtreecommitdiffstats
path: root/modules/programs/git/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/programs/git/default.nix')
-rw-r--r--modules/programs/git/default.nix41
1 files changed, 27 insertions, 14 deletions
diff --git a/modules/programs/git/default.nix b/modules/programs/git/default.nix
index 24d63c7..cfba093 100644
--- a/modules/programs/git/default.nix
+++ b/modules/programs/git/default.nix
@@ -1,6 +1,15 @@
-{ lib, config, ... }:
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
# Git - Distributed version control system
+let
+ passCfg = config.programs.pass;
+ passGitHelper = lib.getExe pkgs.pass-git-helper;
+in
{
options.programs.git = {
username = lib.mkOption {
@@ -15,19 +24,23 @@
config = lib.mkIf config.programs.git.enable {
programs.git = {
- settings = {
- user = {
- name = config.programs.git.username;
- email = config.programs.git.email;
- };
- credential.helper = "store --file ${config.xdg.cacheHome}/git/credential";
- core.askPass = "";
- };
+ settings =
+ lib.recursiveUpdate
+ {
+ user = {
+ name = config.programs.git.username;
+ email = config.programs.git.email;
+ };
+ core.askPass = "";
+ }
+ (
+ lib.optionalAttrs passCfg.enable {
+ credential."https://github.com" = {
+ username = passCfg.github.username;
+ helper = passGitHelper;
+ };
+ }
+ );
};
-
- # The base directory of the credential file must exist
- home.activation.createGitCacheDirectory = lib.hm.dag.entryAfter [
- "writeBoundary"
- ] "mkdir -p ${config.xdg.cacheHome}/git";
};
}