2024-07-11 21:06:41 +00:00
|
|
|
{ lib, config, pkgs, ... }:
|
2024-05-30 06:34:10 +00:00
|
|
|
|
2024-05-30 04:59:06 +00:00
|
|
|
let
|
|
|
|
cfg = config.snowhawk.git;
|
2024-07-24 04:55:42 +00:00
|
|
|
macos = config.snowhawk.macos.enable;
|
2024-07-24 07:24:16 +00:00
|
|
|
sops = config.snowhawk.sops.enable;
|
2024-05-30 04:59:06 +00:00
|
|
|
in
|
2024-02-29 04:43:07 +00:00
|
|
|
{
|
2024-05-30 04:59:06 +00:00
|
|
|
options.snowhawk.git = {
|
|
|
|
enable = lib.mkEnableOption "git";
|
2024-07-11 21:06:41 +00:00
|
|
|
oauth = lib.mkEnableOption "enable git-credential-oauth";
|
2024-05-30 04:59:06 +00:00
|
|
|
};
|
2024-05-30 06:34:10 +00:00
|
|
|
|
2024-05-30 04:59:06 +00:00
|
|
|
config = lib.mkIf cfg.enable {
|
2024-07-11 21:06:41 +00:00
|
|
|
home.packages = lib.mkIf cfg.oauth [
|
|
|
|
pkgs.git-credential-oauth
|
|
|
|
];
|
|
|
|
|
2024-05-30 04:59:06 +00:00
|
|
|
programs.git = {
|
|
|
|
enable = true;
|
|
|
|
userName = "Zynh Ludwig";
|
|
|
|
userEmail = "zynh0722@gmail.com";
|
2024-05-30 06:34:10 +00:00
|
|
|
|
2024-05-30 04:59:06 +00:00
|
|
|
ignores = [
|
|
|
|
"Session.vim"
|
2024-07-24 04:55:42 +00:00
|
|
|
(lib.mkIf macos ".DS_Store")
|
2024-05-30 04:59:06 +00:00
|
|
|
];
|
2024-05-30 06:34:10 +00:00
|
|
|
|
2024-05-30 04:59:06 +00:00
|
|
|
aliases = {
|
|
|
|
co = "checkout";
|
|
|
|
ci = "commit";
|
|
|
|
st = "status";
|
|
|
|
br = "branch";
|
|
|
|
hist = "log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short";
|
|
|
|
type = "cat-file -t";
|
|
|
|
dump = "cat-file -p";
|
|
|
|
graph = "log --graph --decorate --pretty=oneline --abbrev-commit";
|
2024-05-30 07:08:57 +00:00
|
|
|
|
|
|
|
# local patch-wise ignore workflow
|
|
|
|
unchanged = "update-index --assume-unchanged";
|
|
|
|
changed = "update-index --no-assume-unchanged";
|
2024-05-30 07:13:04 +00:00
|
|
|
show-unchanged = ''!"git ls-files -v | sed -e 's/^[a-z] //p; d'\"'';
|
2024-02-29 04:43:07 +00:00
|
|
|
};
|
2024-05-30 06:34:10 +00:00
|
|
|
|
2024-05-30 04:59:06 +00:00
|
|
|
extraConfig = {
|
|
|
|
init.defaultBranch = "main";
|
2024-05-30 06:34:10 +00:00
|
|
|
|
2024-05-30 04:59:06 +00:00
|
|
|
core = {
|
|
|
|
editor = "nvim";
|
|
|
|
autocrlf = "input";
|
|
|
|
safecrlf = true;
|
|
|
|
};
|
2024-05-30 06:34:10 +00:00
|
|
|
|
2024-07-07 22:48:19 +00:00
|
|
|
pull.rebase = true;
|
|
|
|
|
2024-05-30 04:59:06 +00:00
|
|
|
credential = {
|
|
|
|
helper = [
|
|
|
|
"cache --timeout 7200"
|
2024-07-11 21:06:41 +00:00
|
|
|
(lib.mkIf cfg.oauth "oauth")
|
2024-05-30 04:59:06 +00:00
|
|
|
];
|
2024-05-30 06:34:10 +00:00
|
|
|
|
2024-05-30 04:59:06 +00:00
|
|
|
"https://git.zynh.me" = {
|
|
|
|
oauthClientId = "13d5b95d-565d-4264-8961-c45cc38eaa8a";
|
|
|
|
oauthScopes = "read_repository write_repository";
|
|
|
|
oauthAuthURL = "/login/oauth/authorize";
|
|
|
|
oauthTokenURL = "/login/oauth/access_token";
|
|
|
|
};
|
2024-02-29 04:43:07 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|