dotfiles/modules/home/git.nix
eriedaberrie 372a4de5c2 Initial commit
Note: not the actual initial commit.

I swear I will stop repeatedly force pushing to this single commit eventually
ok.
2024-08-16 11:55:07 -07:00

44 lines
1.1 KiB
Nix

{ 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";
};
};
};
}