Factor out git configuration

This commit is contained in:
Nathan McCarty 2023-05-11 11:26:23 -04:00
parent 80e5f8a179
commit f020ff94f5
No known key found for this signature in database
4 changed files with 107 additions and 100 deletions

View File

@ -67,106 +67,6 @@ with lib; {
tmate
];
})
(mkIf (config.nathan.programs.util.git.enable
&& config.nathan.programs.util.git.gpgSign) {
programs.git.signing = {
key = lib.mkDefault "B7A40A5D78C08885";
signByDefault = lib.mkDefault config.nathan.programs.util.git.gpgSign;
};
})
(mkIf (config.nathan.programs.util.git.enable
&& config.nathan.programs.util.git.sshSign) {
home.file.allowedSigners = {
target = ".ssh/allowed_signers";
text = (import ../../../info/ssh-keys.nix).allowedSigners;
};
programs.git = {
extraConfig = {
commit.gpgsign = true;
gpg.format = "ssh";
user.signingkey = "~/.ssh/id_ed25519.pub";
gpg.ssh.allowedSignersFile = "~/.ssh/allowed_signers";
};
};
})
(mkIf config.nathan.programs.util.git.enable {
# Git adjacent packages
home.packages = [
inputs.nixpkgs-unstable.legacyPackages."${pkgs.system}".git-branchless
];
#########################
## Git configuration
#########################
programs.git = {
enable = true;
package = pkgs.gitAndTools.gitFull;
userName = "Nathan McCarty";
userEmail = "nathan@mccarty.io";
ignores = [
"**/*~"
"*~"
"*_archive"
"/auto/"
"auto-save-list"
".cask/"
".dir-locals.el"
"dist/"
"**/.DS_Store"
"*.elc"
"/elpa/"
"/.emacs.desktop"
"/.emacs.desktop.lock"
"/eshell/history"
"/eshell/lastdir"
"flycheck_*.el"
"*_flymake.*"
"/network-security.data"
".org-id-locations"
".persp"
".projectile"
"*.rel"
"/server/"
"tramp"
"\\#*\\#"
];
delta.enable = true;
lfs.enable = true;
extraConfig = {
init = { defaultBranch = "trunk"; };
log = {
showSignature = true;
abbrevCommit = true;
follow = true;
decorate = false;
};
rerere = {
enable = true;
autoupdate = true;
};
merge = {
ff = "only";
conflictstyle = "diff3";
};
push = {
default = "simple";
followTags = true;
};
pull = { rebase = true; };
status = { showUntrackedFiles = "all"; };
transfer = { fsckobjects = true; };
color = { ui = "auto"; };
diff = {
mnemonicPrefix = true;
renames = true;
wordRegex = ".";
submodule = "log";
};
# credential = { helper = "cache"; };
# Disable annoying safe directory nonsense
safe = { directory = "*"; };
};
};
})
(mkIf config.nathan.programs.util.ssh {
#########################
## SSH Configuration

View File

@ -0,0 +1,105 @@
{ config, lib, pkgs, inputs, ... }:
with lib; {
config = mkMerge [
(mkIf (config.nathan.programs.util.git.enable
&& config.nathan.programs.util.git.gpgSign) {
programs.git.signing = {
key = lib.mkDefault "B7A40A5D78C08885";
signByDefault = lib.mkDefault config.nathan.programs.util.git.gpgSign;
};
})
(mkIf (config.nathan.programs.util.git.enable
&& config.nathan.programs.util.git.sshSign) {
home.file.allowedSigners = {
target = ".ssh/allowed_signers";
text = (import ../../../info/ssh-keys.nix).allowedSigners;
};
programs.git = {
extraConfig = {
commit.gpgsign = true;
gpg.format = "ssh";
user.signingkey = "~/.ssh/id_ed25519.pub";
gpg.ssh.allowedSignersFile = "~/.ssh/allowed_signers";
};
};
})
(mkIf config.nathan.programs.util.git.enable {
# Git adjacent packages
home.packages = [
inputs.nixpkgs-unstable.legacyPackages."${pkgs.system}".git-branchless
];
#########################
## Git configuration
#########################
programs.git = {
enable = true;
package = pkgs.gitAndTools.gitFull;
userName = "Nathan McCarty";
userEmail = "nathan@mccarty.io";
ignores = [
"**/*~"
"*~"
"*_archive"
"/auto/"
"auto-save-list"
".cask/"
".dir-locals.el"
"dist/"
"**/.DS_Store"
"*.elc"
"/elpa/"
"/.emacs.desktop"
"/.emacs.desktop.lock"
"/eshell/history"
"/eshell/lastdir"
"flycheck_*.el"
"*_flymake.*"
"/network-security.data"
".org-id-locations"
".persp"
".projectile"
"*.rel"
"/server/"
"tramp"
"\\#*\\#"
];
delta.enable = true;
lfs.enable = true;
extraConfig = {
init = { defaultBranch = "trunk"; };
log = {
showSignature = true;
abbrevCommit = true;
follow = true;
decorate = false;
};
rerere = {
enable = true;
autoupdate = true;
};
merge = {
ff = "only";
conflictstyle = "diff3";
};
push = {
default = "simple";
followTags = true;
};
pull = { rebase = true; };
status = { showUntrackedFiles = "all"; };
transfer = { fsckobjects = true; };
color = { ui = "auto"; };
diff = {
mnemonicPrefix = true;
renames = true;
wordRegex = ".";
submodule = "log";
};
# credential = { helper = "cache"; };
# Disable annoying safe directory nonsense
safe = { directory = "*"; };
};
};
})
];
}

View File

@ -12,6 +12,7 @@ with nLib; {
../common/programs/core.nix
../common/programs/devel.nix
../common/programs/terminal.nix
../common/programs/git.nix
./programs/core.nix
./programs/emacs.nix
./programs/devel.nix

View File

@ -12,6 +12,7 @@ with nLib; {
../common/programs/core.nix
../common/programs/devel.nix
../common/programs/terminal.nix
../common/programs/git.nix
./programs/sway.nix
./programs/communications.nix
./programs/devel.nix