2024-08-25 09:45:58 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
2023-12-17 05:59:09 +00:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.custom-hm.git;
|
|
|
|
in
|
|
|
|
{
|
2023-12-24 10:53:47 +00:00
|
|
|
options.custom-hm.git = {
|
2023-12-17 05:59:09 +00:00
|
|
|
enable = mkEnableOption "Enable git configuration";
|
2024-01-08 07:30:02 +00:00
|
|
|
signing = mkOption {
|
|
|
|
type = types.submodule {
|
|
|
|
options = {
|
|
|
|
enable = mkEnableOption "Git ssh signing";
|
|
|
|
keyFile = mkOption {
|
|
|
|
type = types.str;
|
2024-09-05 01:19:16 +00:00
|
|
|
default = "~/.ssh/id_ed25519_sk.pub";
|
2024-01-08 07:30:02 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-12-17 05:59:09 +00:00
|
|
|
};
|
|
|
|
config = {
|
2024-01-08 07:30:02 +00:00
|
|
|
programs.git = mkIf cfg.enable {
|
2023-12-17 05:59:09 +00:00
|
|
|
enable = true;
|
|
|
|
delta.enable = true;
|
|
|
|
userName = "Xinyang Li";
|
|
|
|
userEmail = "lixinyang411@gmail.com";
|
|
|
|
aliases = {
|
|
|
|
graph = "log --all --oneline --graph --decorate";
|
|
|
|
a = "add";
|
|
|
|
d = "diff";
|
|
|
|
s = "status";
|
|
|
|
};
|
2024-08-25 09:45:58 +00:00
|
|
|
signing = mkIf cfg.signing.enable {
|
2024-01-08 07:30:02 +00:00
|
|
|
signByDefault = true;
|
|
|
|
key = cfg.signing.keyFile;
|
|
|
|
};
|
2024-08-25 09:45:58 +00:00
|
|
|
extraConfig.user = mkIf cfg.signing.enable { signingkey = cfg.signing.keyFile; };
|
|
|
|
extraConfig.gpg = mkIf cfg.signing.enable { format = "ssh"; };
|
2023-12-17 05:59:09 +00:00
|
|
|
};
|
|
|
|
};
|
2024-01-08 07:30:02 +00:00
|
|
|
}
|