69 lines
2 KiB
Nix
69 lines
2 KiB
Nix
# adapted from https://pickard.cc/posts/git-identity-home-manager/
|
|
|
|
{ config, lib, pkgs, ...}:
|
|
|
|
let
|
|
# put a shell script into the nix store
|
|
gitIdentity =
|
|
pkgs.writeShellScriptBin "git-identity" (builtins.readFile ./git-identity);
|
|
in {
|
|
# we will use the excellent fzf in our `git-identity` script, so let's make sure it's available
|
|
# let's add the gitIdentity script to the path as well
|
|
home.packages = with pkgs; [
|
|
gitIdentity
|
|
fzf
|
|
];
|
|
|
|
programs.git = {
|
|
enable = true;
|
|
package = pkgs.gitAndTools.gitFull;
|
|
|
|
extraConfig = {
|
|
# extremely important, otherwise git will attempt to guess a default user identity. see `man git-config` for more details
|
|
user.useConfigOnly = true;
|
|
|
|
# the `inuits` identity
|
|
user.inuits.name = "Lander Van den Bulcke";
|
|
user.inuits.email = "landervdb@inuits.eu";
|
|
|
|
# the `olly` identity
|
|
user.olly.name = "Lander Van den Bulcke";
|
|
user.olly.email = "landervdb@o11y.eu";
|
|
|
|
# the `paynovate` identity
|
|
user.paynovate.name = "Lander Van den Bulcke";
|
|
user.paynovate.email = "lander.vandenbulcke@paynovate.com";
|
|
|
|
# the `personal` identity
|
|
user.personal.name = "Lander Van den Bulcke";
|
|
user.personal.email = "landervandenbulcke@gmail.com";
|
|
|
|
# editor
|
|
core.editor = "vim";
|
|
|
|
# line up default branch with github/codeberg/forgejo
|
|
init.defaultBranch = "main";
|
|
|
|
# always rebase xx
|
|
pull.rebase = true;
|
|
|
|
push.autoSetupRemote = true;
|
|
rebase.autosquash = true;
|
|
commit.verbose = true;
|
|
diff.algorithm = "histogram";
|
|
transfer.fsckobjects = true;
|
|
fetch.fsckobjects = true;
|
|
receive.fsckObjects = true;
|
|
rerere.enabled = true;
|
|
|
|
# sign your commits!
|
|
commit.gpgsign = true;
|
|
};
|
|
# This is optional, as `git identity` will call the `git-identity` script by itself, however
|
|
# setting it up explicitly as an alias gives you autocomplete
|
|
aliases = {
|
|
identity = "! git-identity";
|
|
id = "! git-identity";
|
|
};
|
|
};
|
|
}
|