193 lines
4.7 KiB
Nix
193 lines
4.7 KiB
Nix
{
|
|
pkgs,
|
|
config,
|
|
lib,
|
|
# flake-inputs,
|
|
...
|
|
}:
|
|
with lib;
|
|
let
|
|
cfg = config.eboskma.programs.git;
|
|
in
|
|
{
|
|
options.eboskma.programs.git = {
|
|
enable = mkEnableOption "enable git";
|
|
|
|
package = mkOption {
|
|
description = "The git package to use";
|
|
type = types.package;
|
|
default = pkgs.gitFull;
|
|
};
|
|
|
|
name = mkOption {
|
|
description = "your name";
|
|
type = types.nonEmptyStr;
|
|
};
|
|
|
|
email = mkOption {
|
|
description = "your e-mail address";
|
|
type = types.nonEmptyStr;
|
|
};
|
|
|
|
signingKey = mkOption {
|
|
description = "your signing key";
|
|
type = types.nullOr types.str;
|
|
default = null;
|
|
};
|
|
|
|
signingKeyFormat = mkOption {
|
|
description = "the type of signing key";
|
|
type = types.enum [
|
|
"openpgp"
|
|
"x509"
|
|
"ssh"
|
|
];
|
|
default = "openpgp";
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
programs.git = {
|
|
enable = true;
|
|
package = cfg.package;
|
|
userName = cfg.name;
|
|
userEmail = cfg.email;
|
|
signing = mkIf (cfg.signingKey != null) {
|
|
key = cfg.signingKey;
|
|
signByDefault = true;
|
|
};
|
|
|
|
lfs.enable = true;
|
|
|
|
delta = {
|
|
enable = false;
|
|
options = {
|
|
side-by-side = false;
|
|
};
|
|
};
|
|
|
|
aliases = {
|
|
ls = "ls-files";
|
|
ignored = "ls-files -o -i --exclude-standard";
|
|
st = "status -s -b";
|
|
branches = "branch -a";
|
|
tags = "tag";
|
|
stashes = "stash list";
|
|
nevermind = "!git reset --hard HEAD && git clean -d -f";
|
|
graph = "log --graph -10 --branches --remotes --tags --format=format:'%Cgreen%h %Creset• %<(75,trunc)%s (%cN, %cr) %Cred%d' --date-order";
|
|
precommit = "diff --cached --diff-algorithm=minimal -w";
|
|
track = "branch -u";
|
|
stat = "status -s";
|
|
up = "pull --autostash --rebase";
|
|
cm = "commit -m";
|
|
changelog = "log --oneline --no-merges";
|
|
source = "remote get-url origin";
|
|
};
|
|
|
|
extraConfig = {
|
|
credential = {
|
|
helper = [
|
|
"cache --timeout 900"
|
|
"${pkgs.git-credential-oauth}/bin/git-credential-oauth"
|
|
];
|
|
|
|
"https://dev.azure.com" = {
|
|
useHttpPath = true;
|
|
};
|
|
|
|
"https://git.datarift.nl" = {
|
|
oauthClientId = "a4792ccc-144e-407e-86c9-5e7d8d9c3269";
|
|
oauthAuthURL = "/login/oauth/authorize";
|
|
oauthTokenURL = "/login/oauth/access_token";
|
|
};
|
|
|
|
"http://repohost.bedum.horus.nu" = {
|
|
oauthClientId = "b00b00f53f073f4b38f7c38b1b2a944bb5069d411552a9968f1fca1d3e60395d";
|
|
oauthScopes = "read_repository write_repository";
|
|
oauthAuthURL = "/oauth/authorize";
|
|
oauthTokenURL = "/oauth/token";
|
|
};
|
|
};
|
|
init = {
|
|
defaultBranch = "main";
|
|
};
|
|
core = {
|
|
editor = "${config.eboskma.programs.emacs.package}/bin/emacsclient";
|
|
pager = "${pkgs.bat}/bin/bat";
|
|
untrackedCache = true;
|
|
# fsmonitor =
|
|
# let
|
|
# git-fs-monitor = flake-inputs.git-fs-monitor.packages.${pkgs.system}.default;
|
|
# in
|
|
# "${git-fs-monitor}/bin/git-fs-monitor";
|
|
};
|
|
merge = {
|
|
ff = "only";
|
|
conflictstyle = "diff3";
|
|
tool = "${pkgs.meld}/bin/meld";
|
|
};
|
|
pull = {
|
|
ff = "only";
|
|
};
|
|
push = {
|
|
default = "current";
|
|
};
|
|
rebase = {
|
|
autoStash = true;
|
|
};
|
|
rerere.enabled = true;
|
|
color = {
|
|
ui = "auto";
|
|
status = {
|
|
added = "yellow";
|
|
changed = "green";
|
|
untracked = "cyan";
|
|
};
|
|
branch = {
|
|
current = "yellow reverse";
|
|
local = "yellow";
|
|
remote = "green";
|
|
};
|
|
diff = {
|
|
meta = "yellow bold";
|
|
frag = "magenta bold";
|
|
old = "red bold";
|
|
new = "green bold";
|
|
};
|
|
};
|
|
grep = {
|
|
lineNumber = true;
|
|
column = true;
|
|
patternType = "extended";
|
|
};
|
|
|
|
gpg = {
|
|
format = cfg.signingKeyFormat;
|
|
ssh.allowedSignersFile = "~/.config/git/allowed_signers";
|
|
};
|
|
|
|
url = {
|
|
"ssh://git@repohost.bedum.horus.nu/" = {
|
|
insteadOf = "rh:";
|
|
pushInsteadOf = "rh:";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
programs.gh = {
|
|
enable = true;
|
|
settings = {
|
|
git_protocol = "https";
|
|
editor = "nvim";
|
|
prompt = "enabled";
|
|
pager = "bat";
|
|
http_unix_socket = "";
|
|
browser = "";
|
|
version = "1";
|
|
};
|
|
};
|
|
|
|
home.packages = [ pkgs.gitu ];
|
|
};
|
|
}
|