Added git config
This commit is contained in:
		
							parent
							
								
									3192993253
								
							
						
					
					
						commit
						e62903e640
					
				
					 3 changed files with 98 additions and 0 deletions
				
			
		
							
								
								
									
										87
									
								
								modules/tools/git/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										87
									
								
								modules/tools/git/default.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,87 @@
 | 
			
		|||
{
 | 
			
		||||
  options,
 | 
			
		||||
  config,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
with lib; let
 | 
			
		||||
  cfg = config.aa.tools.git;
 | 
			
		||||
  user = config.aa.user;
 | 
			
		||||
in {
 | 
			
		||||
  options.aa.tools.git = with types; {
 | 
			
		||||
    enable = mkEnableOption "git";
 | 
			
		||||
    userName = mkOption {
 | 
			
		||||
      type = str;
 | 
			
		||||
      default = user.fullName;
 | 
			
		||||
      description = "The name to use for git commits.";
 | 
			
		||||
    };
 | 
			
		||||
    userEmail = mkOption {
 | 
			
		||||
      type = str;
 | 
			
		||||
      default = user.email;
 | 
			
		||||
      description = "The email to use for git commits.";
 | 
			
		||||
    };
 | 
			
		||||
    signingKey = mkOption {
 | 
			
		||||
      type = str;
 | 
			
		||||
      default = "0xE1B13CCEFDEDDFB7";
 | 
			
		||||
      description = "The key ID used to sign commits.";
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  config = mkIf cfg.enable {
 | 
			
		||||
    environment.systemPackages = with pkgs; [git];
 | 
			
		||||
 | 
			
		||||
    aa.home.extraOptions = {
 | 
			
		||||
      programs.git = {
 | 
			
		||||
        delta = {
 | 
			
		||||
          enable = true;
 | 
			
		||||
          options = {
 | 
			
		||||
            line-numbers = true;
 | 
			
		||||
            navigate = true;
 | 
			
		||||
          };
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        enable = true;
 | 
			
		||||
        userName = cfg.userName;
 | 
			
		||||
        userEmail = cfg.userEmail;
 | 
			
		||||
 | 
			
		||||
        aliases = {
 | 
			
		||||
          lol = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative";
 | 
			
		||||
          pushup = "push -u origin HEAD";
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        signing = {
 | 
			
		||||
          key = cfg.signingKey;
 | 
			
		||||
          signByDefault = false; # TODO: Only set if gpg is enabled
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        ignores = [
 | 
			
		||||
          # PyCharm
 | 
			
		||||
          ".idea/"
 | 
			
		||||
 | 
			
		||||
          # Vim artifacts
 | 
			
		||||
          "*.swp"
 | 
			
		||||
          "*.swo"
 | 
			
		||||
          "tags"
 | 
			
		||||
          ".vimspector.json"
 | 
			
		||||
          ".vimlocal"
 | 
			
		||||
          "Session.vim*"
 | 
			
		||||
 | 
			
		||||
          # direnv
 | 
			
		||||
          ".envrc"
 | 
			
		||||
          ".direnv"
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        extraConfig = {
 | 
			
		||||
          init = {
 | 
			
		||||
            defaultBranch = "main";
 | 
			
		||||
          };
 | 
			
		||||
 | 
			
		||||
          pull = {
 | 
			
		||||
            rebase = true;
 | 
			
		||||
          };
 | 
			
		||||
        };
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -14,6 +14,16 @@ in {
 | 
			
		|||
      default = "alejandro";
 | 
			
		||||
      description = "The name to use for the user account.";
 | 
			
		||||
    };
 | 
			
		||||
    fullName = mkOption {
 | 
			
		||||
      type = str;
 | 
			
		||||
      default = "Alejandro Angulo";
 | 
			
		||||
      description = "The full name of the user.";
 | 
			
		||||
    };
 | 
			
		||||
    email = mkOption {
 | 
			
		||||
      type = str;
 | 
			
		||||
      default = "iam@alejandr0angul0.dev";
 | 
			
		||||
      description = "The email of the user.";
 | 
			
		||||
    };
 | 
			
		||||
    extraGroups = mkOption {
 | 
			
		||||
      type = listOf str;
 | 
			
		||||
      default = ["video" "networkmanager" "docker"];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,6 +18,7 @@ with lib; {
 | 
			
		|||
    nix.enable = true;
 | 
			
		||||
 | 
			
		||||
    suites.desktop.enable = true;
 | 
			
		||||
    tools.git.enable = true;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  users.users.virt = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue