added stuff

This commit is contained in:
Charlie Root 2024-04-09 23:11:33 +02:00
commit 9d0ebdfbd0
907 changed files with 70990 additions and 0 deletions

View file

@ -0,0 +1,23 @@
{
programs.git.aliases = {
br = "branch";
c = "commit -m";
ca = "commit -am";
co = "checkout";
d = "diff";
df = "!git hist | peco | awk '{print $2}' | xargs -I {} git diff {}^ {}";
edit-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; vim `f`";
fuck = "commit --amend -m";
graph = "log --all --decorate --graph";
ps = "!git push origin $(git rev-parse --abbrev-ref HEAD)";
pl = "!git pull origin $(git rev-parse --abbrev-ref HEAD)";
af = "!git add $(git ls-files -m -o --exclude-standard | fzf -m)";
st = "status";
hist = ''
log --pretty=format:"%Cgreen%h %Creset%cd %Cblue[%cn] %Creset%s%C(yellow)%d%C(reset)" --graph --date=relative --decorate --all
'';
llog = ''
log --graph --name-status --pretty=format:"%C(red)%h %C(reset)(%cd) %C(green)%an %Creset%s %C(yellow)%d%Creset" --date=relative
'';
};
}

View file

@ -0,0 +1,111 @@
{
osConfig,
pkgs,
...
}: let
inherit (osConfig) modules;
cfg = modules.system.programs.git;
in {
imports = [
./aliases.nix
./ignore.nix
];
config = {
home.packages = with pkgs; [
gist # manage github gists
act # local github actions
zsh-forgit # zsh plugin to load forgit via `git forgit`
gitflow
];
programs.git = {
enable = true;
package = pkgs.gitAndTools.gitFull;
# my credientals
userName = "NotAShelf";
userEmail = "raf@notashelf.dev";
# lets sign using our own key
# this must be provided by the host
signing = {
key = cfg.signingKey;
signByDefault = true;
};
lfs = {
enable = true;
skipSmudge = true;
};
extraConfig = {
# I don't care about the usage of the term "master"
# but main is easier to type, so that's that
init.defaultBranch = "main";
# disable the horrendous GUI password prompt for Git when auth fails
core.askPass = "";
# prefer using libsecret for storing and retrieving credientals
credential.helper = "${pkgs.gitAndTools.gitFull}/bin/git-credential-libsecret";
# delta is some kind of a syntax highlighting pager for git
# it looks nice but I'd like to consider difftastic at some point
delta = {
enable = true;
line-numbers = true;
features = "decorations side-by-side navigate";
options = {
navigate = true;
line-numbers = true;
side-by-side = true;
dark = true;
};
};
branch.autosetupmerge = "true";
pull.ff = "only";
push = {
default = "current";
followTags = true;
autoSetupRemote = true;
};
merge = {
stat = "true";
conflictstyle = "diff3";
};
core.whitespace = "fix,-indent-with-non-tab,trailing-space,cr-at-eol";
color.ui = "auto";
repack.usedeltabaseoffset = "true";
rebase = {
autoSquash = true;
autoStash = true;
};
rerere = {
autoupdate = true;
enabled = true;
};
url = {
"https://github.com/".insteadOf = "github:";
"ssh://git@github.com/".pushInsteadOf = "github:";
"https://gitlab.com/".insteadOf = "gitlab:";
"ssh://git@gitlab.com/".pushInsteadOf = "gitlab:";
"https://aur.archlinux.org/".insteadOf = "aur:";
"ssh://aur@aur.archlinux.org/".pushInsteadOf = "aur:";
"https://git.sr.ht/".insteadOf = "srht:";
"ssh://git@git.sr.ht/".pushInsteadOf = "srht:";
"https://codeberg.org/".insteadOf = "codeberg:";
"ssh://git@codeberg.org/".pushInsteadOf = "codeberg:";
};
};
};
};
}

View file

@ -0,0 +1,53 @@
{lib, ...}: let
general = ''
.cache/
tmp/
*.tmp
log/
'';
ide = ''
*.swp
.idea/
.~lock*
'';
c = ''
.tags
tags
*~
*.o
*.so
*.cmake
CMakeCache.txt
CMakeFiles/
cmake-build-debug/
compile_commands.json
.ccls*
'';
nix = ''
result
result-*
.direnv/
'';
node = ''
node_modules/
'';
python = ''
venv
.venv
*pyc
*.egg-info/
__pycached__/
.mypy_cache
'';
ignore = lib.concatStringsSep "\n" [general c nix node ide python];
in {
# construct the list of ignored files from a very large string containing
# the list of ignored files, but in a plaintext format for my own convenience
programs.git.ignores = map (v: "${toString v}") (builtins.split "\n" ignore);
}