mochi/nixos/home/modules/shell/git/default.nix

71 lines
1.6 KiB
Nix
Raw Normal View History

2024-06-20 08:59:56 -05:00
{ pkgs, config, lib, ... }:
let
cfg = config.myHome.shell.git;
in
{
options.myHome.shell.git = {
enable = lib.mkEnableOption "git";
username = lib.mkOption {
type = lib.types.str;
};
email = lib.mkOption {
type = lib.types.str;
};
signingKey = lib.mkOption {
type = lib.types.str;
};
};
config = lib.mkMerge [
(lib.mkIf cfg.enable {
2024-07-30 18:47:59 -05:00
programs = {
gh.enable = true;
gpg.enable = true;
git = {
enable = true;
2024-06-20 08:59:56 -05:00
2024-07-30 18:47:59 -05:00
userName = cfg.username;
userEmail = cfg.email;
2024-06-20 08:59:56 -05:00
2024-07-30 18:47:59 -05:00
extraConfig = {
core.autocrlf = "input";
init.defaultBranch = "main";
pull.rebase = true;
rebase.autoStash = true;
# public key for signing commits
user.signingKey = cfg.signingKey;
# ssh instead of gpg
gpg.format = "ssh";
# 1password signing gui git signing
gpg.ssh.program = "${pkgs._1password-gui}/bin/op-ssh-sign";
# Auto sign commits without -S
commit.gpgsign = true;
};
aliases = {
co = "checkout";
};
ignores = [
# Mac OS X hidden files
".DS_Store"
# Windows files
"Thumbs.db"
# asdf
".tool-versions"
# Sops
".decrypted~*"
"*.decrypted.*"
# Python virtualenvs
".venv"
];
2024-06-20 08:59:56 -05:00
};
};
home.packages = [
pkgs.git-filter-repo
pkgs.tig
2024-08-07 10:39:08 -05:00
pkgs.unstable.lazygit
2024-06-20 08:59:56 -05:00
];
})
];
}