-104
@@ -1,104 +0,0 @@
|
|||||||
[include]
|
|
||||||
path = ~/.gitconfig.email
|
|
||||||
|
|
||||||
[core]
|
|
||||||
editor = nvim
|
|
||||||
excludesfile = ~/.gitignore
|
|
||||||
|
|
||||||
[user]
|
|
||||||
name = Hektor Misplon
|
|
||||||
username = hektor
|
|
||||||
signingKey = AEB98353B8D72E465C4236435151AF79E723F21C
|
|
||||||
|
|
||||||
[alias]
|
|
||||||
d = diff
|
|
||||||
ds = diff --staged
|
|
||||||
a = add
|
|
||||||
ap = add -p
|
|
||||||
c = commit
|
|
||||||
cm = commit -m
|
|
||||||
cam = commit --amend
|
|
||||||
l = log --pretty=format:"(%an)\\ \\ %h\\ \\ %ad\\ \\ %s" --date=short
|
|
||||||
s = status --short
|
|
||||||
sv = status --verbose
|
|
||||||
co = checkout
|
|
||||||
cob = checkout -b
|
|
||||||
pullr = "pull --rebase --autostash"
|
|
||||||
pushf = "push --force-with-lease"
|
|
||||||
# Note these follow the naming convention of my `.bash_aliases`
|
|
||||||
al = "!git config -l | grep alias | cut -c 7-"
|
|
||||||
alf = "!git config -l | grep alias | cut -c 7- | fzf"
|
|
||||||
al- = "!git config --local --unset $(git config -l | grep alias | cut --delimiter="=" --fields=1 | fzf)"
|
|
||||||
rs = "restore --staged"
|
|
||||||
rb = "rebase"
|
|
||||||
rbi = "rebase -i"
|
|
||||||
wt = "worktree"
|
|
||||||
wtc = "config remote.origin.fetch \"+refs/heads/*:refs/remotes/origin/*\""
|
|
||||||
|
|
||||||
[color]
|
|
||||||
ui = auto
|
|
||||||
|
|
||||||
[color "diff"]
|
|
||||||
meta = yellow bold
|
|
||||||
commit = green bold
|
|
||||||
frag = magenta bold
|
|
||||||
old = red bold
|
|
||||||
new = green bold
|
|
||||||
whitespace = red reverse
|
|
||||||
|
|
||||||
[color "diff-highlight"]
|
|
||||||
oldNormal = red bold
|
|
||||||
oldHighlight = "red bold 52"
|
|
||||||
newNormal = "green bold"
|
|
||||||
newHighlight = "green bold 22"
|
|
||||||
|
|
||||||
[color "branch"]
|
|
||||||
current = normal bold
|
|
||||||
local = normal
|
|
||||||
remote = normal italic
|
|
||||||
|
|
||||||
[color "status"]
|
|
||||||
added = green
|
|
||||||
changed = yellow
|
|
||||||
untracked = normal italic
|
|
||||||
|
|
||||||
[credential]
|
|
||||||
helper = cache --timeout=3600
|
|
||||||
|
|
||||||
[init]
|
|
||||||
defaultBranch = main
|
|
||||||
|
|
||||||
[log]
|
|
||||||
date = relative
|
|
||||||
abbrevCommit = true
|
|
||||||
|
|
||||||
[credential "https://github.com"]
|
|
||||||
helper = !gh auth git-credential
|
|
||||||
|
|
||||||
[merge]
|
|
||||||
tool = nvimdiff
|
|
||||||
conflictstyle = diff3
|
|
||||||
[diff]
|
|
||||||
colorMoved = zebra
|
|
||||||
tool = nvimdiff
|
|
||||||
[difftool]
|
|
||||||
prompt = false
|
|
||||||
[mergetool]
|
|
||||||
prompt = false
|
|
||||||
keepBackup = false
|
|
||||||
[commit]
|
|
||||||
gpgsign = false
|
|
||||||
|
|
||||||
[interactive]
|
|
||||||
singleKey = true
|
|
||||||
|
|
||||||
[pull]
|
|
||||||
rebase = true
|
|
||||||
[rerere]
|
|
||||||
enabled = true
|
|
||||||
|
|
||||||
[includeIf "gitdir:~/work/"]
|
|
||||||
path = ~/.gitconfig.work
|
|
||||||
|
|
||||||
[includeIf "gitdir:~/nix-dev-shells/"]
|
|
||||||
path = ~/.gitconfig.work
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
[user]
|
|
||||||
email = your.email@example.com
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
[include]
|
|
||||||
path = ~/.gitconfig.work.email
|
|
||||||
|
|
||||||
[core]
|
|
||||||
longpaths = true
|
|
||||||
|
|
||||||
[user]
|
|
||||||
name = Hektor Misplon
|
|
||||||
username = hektor.misplon
|
|
||||||
signingKey = 1C88BE828184CEE6
|
|
||||||
|
|
||||||
[commit]
|
|
||||||
gpgsign = false
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
[user]
|
|
||||||
email = your.work.email@example.com
|
|
||||||
+156
-15
@@ -1,10 +1,31 @@
|
|||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
|
inputs,
|
||||||
lib,
|
lib,
|
||||||
dotsPath,
|
myUtils,
|
||||||
|
osConfig ? null,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.git;
|
||||||
|
sops = myUtils.sopsAvailability config osConfig;
|
||||||
|
standalone = osConfig == null;
|
||||||
|
|
||||||
|
personalEmail = sops.templates.".gitconfig.email".path;
|
||||||
|
workEmail = sops.templates.".gitconfig.work.email".path;
|
||||||
|
|
||||||
|
workSettings = {
|
||||||
|
include.path = workEmail;
|
||||||
|
core.longpaths = true;
|
||||||
|
user = {
|
||||||
|
name = "Hektor Misplon";
|
||||||
|
username = "hektor.misplon";
|
||||||
|
signingKey = "1C88BE828184CEE6";
|
||||||
|
};
|
||||||
|
commit.gpgSign = false;
|
||||||
|
};
|
||||||
|
in
|
||||||
{
|
{
|
||||||
options.git = {
|
options.git = {
|
||||||
enable = lib.mkEnableOption "git";
|
enable = lib.mkEnableOption "git";
|
||||||
@@ -26,18 +47,138 @@
|
|||||||
./gitlab.nix
|
./gitlab.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
config = lib.mkIf config.git.enable {
|
config = lib.mkIf cfg.enable (
|
||||||
assertions = [
|
lib.optionalAttrs standalone {
|
||||||
{
|
sops = {
|
||||||
assertion = config.nvim.enable;
|
secrets = myUtils.mkSopsSecrets "${toString inputs.nix-secrets}/secrets" {
|
||||||
message = "git module requires 'nvim' module (`nvimdiff`)";
|
email = [
|
||||||
}
|
"personal"
|
||||||
];
|
"work"
|
||||||
programs.git.enable = true;
|
];
|
||||||
home.file = {
|
};
|
||||||
".gitconfig".source = dotsPath + "/.gitconfig";
|
|
||||||
".gitconfig.work".source = dotsPath + "/.gitconfig.work";
|
templates = {
|
||||||
".gitignore".source = dotsPath + "/.gitignore";
|
".gitconfig.email".content = ''
|
||||||
};
|
[user]
|
||||||
};
|
email = ${config.sops.placeholder."email/personal"}
|
||||||
|
'';
|
||||||
|
".gitconfig.work.email".content = ''
|
||||||
|
[user]
|
||||||
|
email = ${config.sops.placeholder."email/work"}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// {
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = config.nvim.enable;
|
||||||
|
message = "git module requires 'nvim' module (`nvimdiff`)";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
xdg.configFile."git/ignore".source = ./global.gitignore;
|
||||||
|
|
||||||
|
programs.git = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
core.editor = "nvim";
|
||||||
|
user = {
|
||||||
|
name = "Hektor Misplon";
|
||||||
|
username = "hektor";
|
||||||
|
signingKey = "AEB98353B8D72E465C4236435151AF79E723F21C";
|
||||||
|
};
|
||||||
|
alias = {
|
||||||
|
d = "diff";
|
||||||
|
ds = "diff --staged";
|
||||||
|
a = "add";
|
||||||
|
ap = "add -p";
|
||||||
|
c = "commit";
|
||||||
|
cm = "commit -m";
|
||||||
|
cam = "commit --amend";
|
||||||
|
l = ''log --pretty=format:(%an)\ \ %h\ \ %ad\ \ %s --date=short'';
|
||||||
|
s = "status --short";
|
||||||
|
sv = "status --verbose";
|
||||||
|
co = "checkout";
|
||||||
|
cob = "checkout -b";
|
||||||
|
pullr = "pull --rebase --autostash";
|
||||||
|
pushf = "push --force-with-lease";
|
||||||
|
al = "!git config -l | grep alias | cut -c 7-";
|
||||||
|
alf = "!git config -l | grep alias | cut -c 7- | fzf";
|
||||||
|
"al-" =
|
||||||
|
''!git config --local --unset $(git config -l | grep alias | cut --delimiter="=" --fields=1 | fzf)'';
|
||||||
|
rs = "restore --staged";
|
||||||
|
rb = "rebase";
|
||||||
|
rbi = "rebase -i";
|
||||||
|
wt = "worktree";
|
||||||
|
wtc = ''config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"'';
|
||||||
|
};
|
||||||
|
color = {
|
||||||
|
ui = "auto";
|
||||||
|
diff = {
|
||||||
|
meta = "yellow bold";
|
||||||
|
commit = "green bold";
|
||||||
|
frag = "magenta bold";
|
||||||
|
old = "red bold";
|
||||||
|
new = "green bold";
|
||||||
|
whitespace = "red reverse";
|
||||||
|
};
|
||||||
|
"diff-highlight" = {
|
||||||
|
oldNormal = "red bold";
|
||||||
|
oldHighlight = "red bold 52";
|
||||||
|
newNormal = "green bold";
|
||||||
|
newHighlight = "green bold 22";
|
||||||
|
};
|
||||||
|
branch = {
|
||||||
|
current = "normal bold";
|
||||||
|
local = "normal";
|
||||||
|
remote = "normal italic";
|
||||||
|
};
|
||||||
|
status = {
|
||||||
|
added = "green";
|
||||||
|
changed = "yellow";
|
||||||
|
untracked = "normal italic";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
credential.helper = "cache --timeout=3600";
|
||||||
|
init.defaultBranch = "main";
|
||||||
|
log = {
|
||||||
|
date = "relative";
|
||||||
|
abbrevCommit = true;
|
||||||
|
};
|
||||||
|
merge = {
|
||||||
|
tool = "nvimdiff";
|
||||||
|
conflictStyle = "diff3";
|
||||||
|
};
|
||||||
|
diff = {
|
||||||
|
colorMoved = "zebra";
|
||||||
|
tool = "nvimdiff";
|
||||||
|
};
|
||||||
|
difftool.prompt = false;
|
||||||
|
mergetool = {
|
||||||
|
prompt = false;
|
||||||
|
keepBackup = false;
|
||||||
|
};
|
||||||
|
commit.gpgSign = false;
|
||||||
|
interactive.singleKey = true;
|
||||||
|
pull.rebase = true;
|
||||||
|
rerere.enabled = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
includes = [
|
||||||
|
{ path = personalEmail; }
|
||||||
|
{
|
||||||
|
condition = "gitdir:~/work/";
|
||||||
|
contents = workSettings;
|
||||||
|
contentSuffix = "gitconfig-work";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
condition = "gitdir:~/nix-dev-shells/";
|
||||||
|
contents = workSettings;
|
||||||
|
contentSuffix = "gitconfig-work";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ in
|
|||||||
sops.templates = {
|
sops.templates = {
|
||||||
".gitconfig.email" = {
|
".gitconfig.email" = {
|
||||||
inherit owner;
|
inherit owner;
|
||||||
path = "/home/${username}/.gitconfig.email";
|
|
||||||
content = ''
|
content = ''
|
||||||
[user]
|
[user]
|
||||||
email = ${config.sops.placeholder."email/personal"}
|
email = ${config.sops.placeholder."email/personal"}
|
||||||
@@ -20,7 +19,6 @@ in
|
|||||||
};
|
};
|
||||||
".gitconfig.work.email" = {
|
".gitconfig.work.email" = {
|
||||||
inherit owner;
|
inherit owner;
|
||||||
path = "/home/${username}/.gitconfig.work.email";
|
|
||||||
content = ''
|
content = ''
|
||||||
[user]
|
[user]
|
||||||
email = ${config.sops.placeholder."email/work"}
|
email = ${config.sops.placeholder."email/work"}
|
||||||
|
|||||||
Reference in New Issue
Block a user