2023-12-17 05:59:09 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
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-03-25 17:56:59 +00:00
|
|
|
default = "~/.ssh/id_ecdsa.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-01-08 07:30:02 +00:00
|
|
|
signing = mkIf cfg.signing.enable {
|
|
|
|
signByDefault = true;
|
|
|
|
key = cfg.signing.keyFile;
|
|
|
|
};
|
|
|
|
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
|
|
|
}
|