nix-dotfiles/modules/software/dev/git.nix

63 lines
1.4 KiB
Nix

{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.modules.software.dev.git;
in {
options.modules.software.dev.git = {
enable = mkEnableOption "Enable git. You know what git is";
package = mkOption {
type = types.package;
default = pkgs.gitFull;
example = "pkgs.gitFull";
};
};
config = mkIf cfg.enable {
hm.programs.git = {
enable = true;
package = cfg.package;
userName = ''reidlab'';
userEmail = "reidlab325@gmail.com";
signing = {
signByDefault = true;
key = "DAF5EAF6665839FD";
};
ignores = [
# General
"*.direnv"
"*.envrc"
# OS related
".DS_Store?"
".DS_Store"
".CFUserTextEncoding"
".Trash"
".Xauthority"
"thumbs.db"
"Thumbs.db"
"Icon?"
];
aliases = {
graph = ''log --graph --color --pretty=format:"%C(yellow)%H%C(green)%d%C(reset)%n%x20%cd%n%x20%cn%x20(%ce)%n%x20%s%n"'';
amend = ''commit --amend --no-edit'';
amendall = ''commit --amend --no-edit --all'';
};
extraConfig = {
credential.helper = "${cfg.package}/bin/git-credential-libsecret";
push.autoSetupRemote = true;
push.gpgSign = "if-asked";
pull.rebase = true;
init.defaultBranch = "main";
};
};
hm.programs.gh.enable = true;
};
}