config/users/pbsds/home/profiles/git.nix

94 lines
2.9 KiB
Nix
Raw Normal View History

2023-03-03 23:33:37 +01:00
{ pkgs, ... }:
{
2023-03-12 05:14:28 +01:00
home.packages = with pkgs; [
2024-02-18 22:14:40 +01:00
#git
2024-06-15 20:34:46 +02:00
gh
2024-10-31 16:25:35 +01:00
#hub
(pkgs.symlinkJoin {
inherit (pkgs.hub) name meta;
paths = [ pkgs.hub ];
postBuild = ''
rm $out/bin/hub
cat <<"EOF" >$out/bin/hub
#!${pkgs.runtimeShell}
# https://hub.github.com/hub.1.html#github-oauth-authentication
if [[ ! -d ~/.config/hub ]]; then
export GITHUB_TOKEN=$(${pkgs.gh}/bin/gh auth token 2>/dev/null)
fi
exec -a "$0" ${pkgs.hub}/bin/hub "$@"
EOF
chmod +x $out/bin/hub
'';
})
2024-08-04 04:54:14 +02:00
tea
2024-01-26 01:46:33 +01:00
colordiff
2023-03-12 05:14:28 +01:00
];
2023-03-04 00:09:57 +01:00
2024-06-15 20:34:46 +02:00
#programs.gh.enable = true; # adds read-only config to .config
2024-02-18 22:14:40 +01:00
2023-03-03 23:33:37 +01:00
#programs.git.gitui.enable = true;
programs.git.enable = true;
2024-02-25 21:26:02 +01:00
programs.git.lfs.enable = true;
2023-03-03 23:33:37 +01:00
programs.git.delta.enable = true;
2024-05-30 20:45:37 +02:00
programs.git.delta.options.max-line-length = 2000;
2023-03-03 23:33:37 +01:00
#programs.git.lfs.enable = true;
#programs.git.signing
#programs.git.userName = "pbsds"
programs.git.userName = "Peder Bergebakken Sundt";
programs.git.userEmail = "pbsds@hotmail.com";
2024-02-17 17:08:51 +01:00
# https://jvns.ca/blog/2024/02/16/popular-git-config-options/
programs.git.extraConfig.rerere.enabled = true;
2024-06-15 20:34:46 +02:00
#programs.git.extraConfig.help.autocorrect = "prompt";
2024-02-17 17:08:51 +01:00
programs.git.extraConfig.transfer.fsckobjects = true;
programs.git.extraConfig.fetch.fsckobjects = true;
programs.git.extraConfig.receive.fsckObjects = true;
programs.git.extraConfig.branch.sort = "-committerdate";
programs.git.extraConfig.tag.sort = "taggerdate";
programs.git.extraConfig.fetch.prune = true;
programs.git.extraConfig.fetch.prunetags = true;
programs.git.extraConfig.log.date = "iso";
2024-08-14 17:09:15 +02:00
/* programs.git.extraConfig.interactive.singleKey = true; */
2024-02-17 17:08:51 +01:00
2024-06-15 20:34:46 +02:00
programs.git.iniContent.init.defaultBranch = "main";
2023-03-03 23:33:37 +01:00
programs.git.ignores = [
2024-08-11 00:27:53 +02:00
#".envrc"
2024-02-26 10:39:17 +01:00
".remote.toml"
2024-08-11 00:27:53 +02:00
".remoteenv"
2023-03-03 23:33:37 +01:00
"result"
2024-08-11 00:27:53 +02:00
"result-*"
2024-10-19 04:05:19 +02:00
"results"
"results-*"
2023-03-03 23:33:37 +01:00
"__pycache__"
2023-03-12 05:14:28 +01:00
"*.pyc"
2023-03-03 23:33:37 +01:00
];
home.shellAliases = {
# git gud
2023-03-12 05:14:28 +01:00
gs = "git status";
gl = "git log --oneline --color | head -n 30";
glg = "git log --all --decorate --oneline --graph";
gpra = "git pull --rebase --autostash";
gd = "git diff";
gdwd = "git diff --word-diff";
gdwdr = "git diff --word-diff --word-diff-regex=.";
gds = "git diff --staged";
gdswd = "git diff --staged --word-diff";
2023-03-03 23:33:37 +01:00
gdswdr = "git diff --staged --word-diff --word-diff-regex=.";
2023-03-12 05:14:28 +01:00
gcp = "git cherry-pick";
gca = "git commit --amend";
gcara = "git commit --amend --reset-author";
gfr = "git pull --rebase";
2024-08-11 00:10:10 +02:00
gc = "git branch | cut -c2- | gum choose | xargs git checkout";
gbrm = "git fetch origin; git branch --merged | cut -c3- | grep -vE '^(main|master)$' | gum choose --no-limit --header 'Which branches to delete:' | xargs git branch -D";
#gb = "git blame";
#gpo = "git push origin";
2024-10-27 13:30:44 +01:00
#gpf = "git push --force-with-lease --force-if-includes";
2023-03-03 23:33:37 +01:00
};
}