aboutsummaryrefslogtreecommitdiff
path: root/nix/users/fcuny/git.nix
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2024-12-16 09:25:23 -0800
committerFranck Cuny <franck@fcuny.net>2024-12-16 09:25:23 -0800
commit1bbd4e19c5595e6a6c310bd36fac5b4bd97ff39f (patch)
treee5ec852d0aa9378a5fae766f70d4c133acd5f8d1 /nix/users/fcuny/git.nix
parentmove gitotlite to vm-synology (diff)
downloadinfra-1bbd4e19c5595e6a6c310bd36fac5b4bd97ff39f.tar.gz
refactor home-manager
Only install what's needed for specific OSes.
Diffstat (limited to 'nix/users/fcuny/git.nix')
-rw-r--r--nix/users/fcuny/git.nix59
1 files changed, 59 insertions, 0 deletions
diff --git a/nix/users/fcuny/git.nix b/nix/users/fcuny/git.nix
new file mode 100644
index 0000000..6300f36
--- /dev/null
+++ b/nix/users/fcuny/git.nix
@@ -0,0 +1,59 @@
+{ lib, pkgs, ... }: {
+ home.packages = with pkgs; [
+ gitAndTools.pre-commit
+ git-credential-manager
+ gh
+ ];
+
+ programs.git = {
+ enable = true;
+ userName = "Franck Cuny";
+ userEmail = "franck@fcuny.net";
+
+ aliases = { amend = "commit --amend"; };
+
+ includes = [
+ {
+ condition = "hasconfig:remote.*.url:git@github.rbx.com:**";
+ path = pkgs.writeText "finsitGitConfig"
+ (lib.generators.toGitINI { user.email = "fcuny@roblox.com"; });
+ }
+ {
+ condition = "hasconfig:remote.*.url:git@github.com:Roblox/**";
+ path = pkgs.writeText "finsitGitConfig"
+ (lib.generators.toGitINI { user.email = "fcuny@roblox.com"; });
+ }
+ ];
+
+ extraConfig = {
+ core.whitespace = "trailing-space,space-before-tab";
+ color.ui = "true";
+
+ # abort if the remote branch does not match the local one
+ push.default = "simple";
+
+ # https://adamj.eu/tech/2024/01/18/git-improve-diff-histogram/
+ diff.algorithm = "histogram";
+
+ init.defaultBranch = "main";
+
+ pull.rebase = true;
+ rebase = {
+ # Automatically create a temporary stash entry before the
+ # operation begins, and apply it after the operation ends.
+ autoStash = true;
+ # Print a warning if some commits are removed
+ missingCommitsCheck = "warn";
+ };
+
+ branch.autosetuprebase = "remote";
+ branch.sort = "authordate";
+
+ url = {
+ "ssh://git@github.rbx.com/" = {
+ insteadOf = "https://github.rbx.com/";
+ };
+ };
+ };
+ };
+}