This repository has been archived on 2024-07-08. You can view files and clone it, but cannot push or open issues or pull requests.
nix-config-tn/nixos/home/modules/shell/git/default.nix

76 lines
1.6 KiB
Nix
Raw Permalink Normal View History

{ pkgs
, config
, lib
, ...
}:
let
cfg = config.myHome.shell.git;
inherit (pkgs.stdenv) isDarwin;
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 {
programs.gh.enable = true;
programs.gpg.enable = true;
programs.git = {
enable = true;
userName = cfg.username;
userEmail = cfg.email;
extraConfig = {
2024-05-31 09:41:25 -05:00
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
2024-05-30 21:33:06 -05:00
gpg.format = "ssh";
2024-05-31 08:45:51 -05:00
# gpg.ssh.program = "/etc/profiles/per-user/jahanson/bin/op-ssh-sign";
2024-05-31 09:41:25 -05:00
# 1password signing gui git signing
2024-05-31 08:45:51 -05:00
gpg.ssh.program = "${pkgs._1password-gui}/bin/op-ssh-sign";
2024-05-31 09:41:25 -05:00
# 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"
];
};
home.packages = [
pkgs.git-filter-repo
pkgs.tig
2024-05-30 21:33:06 -05:00
pkgs.lazygit
];
})
];
}