nixos-config/modules/home-manager/git.nix

49 lines
1 KiB
Nix
Raw Permalink Normal View History

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
{
options.custom-hm.git = {
2023-12-17 05:59:09 +00:00
enable = mkEnableOption "Enable git configuration";
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";
};
};
};
};
2023-12-17 05:59:09 +00:00
};
config = {
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 {
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
};
};
}