nixos/home-manager/modules/programs/git/default.nix

152 lines
3.2 KiB
Nix
Raw Normal View History

2023-06-12 10:10:38 +02:00
{ config, lib, ... }:
2024-02-02 13:45:05 +01:00
let
cfg = config.programs.az-git;
in
{
2023-06-12 10:10:38 +02:00
options = {
programs.az-git = {
enable = lib.mkEnableOption "Enable git.";
userEmail = lib.mkOption {
type = lib.types.str;
description = "The hostname of the system.";
default = "andreas@zweili.ch";
};
};
};
config = lib.mkIf cfg.enable {
programs.git = {
enable = true;
userName = "Andreas Zweili";
userEmail = cfg.userEmail;
delta = {
enable = true;
options = {
navigate = true;
line-numbers = true;
syntax-theme = "GitHub";
};
};
2024-02-02 13:45:05 +01:00
includes = [
{
path = "~/.config/git/workconfig";
condition = "gitdir:~/git_repos/work/";
}
];
2023-06-12 10:10:38 +02:00
extraConfig = {
2024-02-02 13:45:05 +01:00
core = {
hooksPath = "~/.config/git/hooks/";
2024-03-05 14:15:25 +01:00
autocrlf = "input";
2024-02-02 13:45:05 +01:00
};
safe = {
directory = "*";
};
pull = {
rebase = false;
};
push = {
autoSetupRemote = true;
};
2023-11-07 21:26:59 +01:00
merge.conflictStyle = "diff3";
2023-11-07 21:27:06 +01:00
rerere.enabled = true;
2023-06-12 10:10:38 +02:00
};
ignores = [
# ---> VisualStudioCode
".vscode/*"
"!.vscode/settings.json"
"!.vscode/tasks.json"
"!.vscode/launch.json"
"!.vscode/extensions.json"
"*.code-workspace"
# Local History for Visual Studio Code"
".history/"
# ---> Emacs"
# -*- mode: gitignore; -*-"
"*~"
2024-01-01 13:14:24 +01:00
"#*#"
2023-06-12 10:10:38 +02:00
"/.emacs.desktop"
"/.emacs.desktop.lock"
"*.elc"
"auto-save-list"
"tramp"
2024-01-01 13:14:24 +01:00
".#*"
2023-06-12 10:10:38 +02:00
# Org-mode"
".org-id-locations"
"*_archive"
# flymake-mode"
"*_flymake.*"
# eshell files"
"/eshell/history"
"/eshell/lastdir"
# elpa packages"
"/elpa/"
# reftex files"
"*.rel"
# AUCTeX auto folder"
"/auto/"
# cask packages"
".cask/"
"dist/"
# Flycheck"
"flycheck_*.el"
# server auth directory"
"/server/"
# projectiles files"
".projectile"
# directory configuration"
".dir-locals.el"
# network security"
"/network-security.data"
# ---> Vim"
# Swap"
"[._]*.s[a-v][a-z]"
"!*.svg # comment out if you don't need vector files"
"[._]*.sw[a-p]"
"[._]s[a-rt-v][a-z]"
"[._]ss[a-gi-z]"
"[._]sw[a-p]"
# Session"
"Session.vim"
"Sessionx.vim"
# Temporary"
".netrwhist"
"*~"
# Auto-generated tag files"
"tags"
# Persistent undo"
"[._]*.un~"
# ignore pycache"
"__pycache__/"
];
};
# raw files
home.file.".config/git/hooks".source = ./hooks;
2023-06-25 12:58:32 +02:00
home.file.".config/git/workconfig".source = ./workconfig;
2023-06-12 10:10:38 +02:00
home.shellAliases = {
git-clean = ''
git fetch --all -p;
git branch --merged origin/master | grep -v "\*" | xargs git branch -d;
git branch -vv | grep -v '\[origin/'| grep -v "\*" | awk '{ print $1; }' | xargs -r git branch -D;
'';
};
};
}