dotfiles/modules/home/git.nix

44 lines
1.1 KiB
Nix
Raw Normal View History

{ pkgs, config, lib, osConfig, ... }:
let
cfg = config.my.git;
in {
options.my.git = {
enable = lib.mkEnableOption null;
};
config = lib.mkIf cfg.enable {
home = {
sessionVariables.FILTER_BRANCH_SQUELCH_WARNING = 1;
shellAliases = {
g = "git";
lg = "lazygit";
};
packages = with pkgs; [
git-absorb
];
};
programs.git = {
enable = true;
inherit (osConfig.programs.git) package;
userName = "eriedaberrie";
userEmail = "eriedaberrie@gmail.com";
aliases = {
hardfetch = "!git fetch --progress $1 && git reset --hard $1 && :";
pushf = "push --force-with-lease";
syncdates = "filter-branch --env-filter 'export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"'";
};
extraConfig = {
commit.verbose = true;
init.defaultBranch = "main";
pull.rebase = true;
push.autoSetupRemote = true;
rebase.autoStash = true;
rerere.enabled = true;
github.user = "eriedaberrie";
gitlab.user = "eriedaberrie";
};
};
};
}