Initial commit
This commit is contained in:
commit
cfcc57a8bd
353 changed files with 18756 additions and 0 deletions
283
module/aspect/software/code/version-control/git.nix
Normal file
283
module/aspect/software/code/version-control/git.nix
Normal file
|
|
@ -0,0 +1,283 @@
|
|||
_:
|
||||
{
|
||||
den.aspects = {
|
||||
version-control = {
|
||||
homeManager =
|
||||
{ config, ... }:
|
||||
{
|
||||
programs = {
|
||||
git = {
|
||||
enable = true;
|
||||
settings.user.name = _.config.meta.${config.home.username}.username;
|
||||
settings.user.email = _.config.meta.${config.home.username}.email;
|
||||
ignores = [
|
||||
".direnv/"
|
||||
"result"
|
||||
];
|
||||
settings.alias = {
|
||||
ll = "log --stat --abbrev-commit";
|
||||
co = "checkout";
|
||||
patch = "format-patch --stdout HEAD~1";
|
||||
rpatch = "reset --hard HEAD~1";
|
||||
lgg = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative";
|
||||
lol = "log --graph --decorate --pretty=oneline --abbrev-commit";
|
||||
lola = "log --graph --decorate --pretty=oneline --abbrev-commit --all";
|
||||
clb = "!/home/user/bin/git-clean-local-branches";
|
||||
pf = "push --force-with-lease";
|
||||
rewrite = "rebase - x 'git commit - -amend - C HEAD - -date=\"$(date -R)\" && sleep 1.05'";
|
||||
# From https://gist.github.com/pksunkara/988716
|
||||
a = "add --all";
|
||||
ai = "add -i";
|
||||
# -----
|
||||
ap = "apply";
|
||||
as = "apply --stat";
|
||||
ac = "apply --check";
|
||||
# -----
|
||||
ama = "am --abort";
|
||||
amr = "am --resolved";
|
||||
ams = "am --skip";
|
||||
# -----
|
||||
b = "branch";
|
||||
ba = "branch -a";
|
||||
bd = "branch -d";
|
||||
bdd = "branch -D";
|
||||
br = "branch -r";
|
||||
bc = "rev-parse --abbrev-ref HEAD";
|
||||
bu = ''!git rev-parse --abbrev-ref --symbolic-full-name "@{u}"'';
|
||||
recent-branches = "branch --sort=-committerdate";
|
||||
# -----
|
||||
c = "commit";
|
||||
ca = "commit -a";
|
||||
cm = "commit -m";
|
||||
cam = "commit -am";
|
||||
cem = "commit --allow-empty -m";
|
||||
cd = "commit --amend";
|
||||
cad = "commit -a --amend";
|
||||
ced = "commit --allow-empty --amend";
|
||||
# -----
|
||||
cl = "clone";
|
||||
cld = "clone --depth 1";
|
||||
clg = "!sh -c 'git clone git://github.com/$1 $(basename $1)' -";
|
||||
clgp = "!sh -c 'git clone git@github.com:$(git config --get user.username)/$1 $1' -";
|
||||
# -----
|
||||
co-pr = "!sh -c 'git fetch origin refs/pull/$1/head:pull/$1 && git checkout pull/$1' -";
|
||||
cp = "cherry-pick";
|
||||
cpa = "cherry-pick --abort";
|
||||
cpc = "cherry-pick --continue";
|
||||
# -----
|
||||
d = "diff";
|
||||
dp = "diff --patience";
|
||||
dc = "diff --cached";
|
||||
dk = "diff --check";
|
||||
dck = "diff --cached --check";
|
||||
dt = "difftool";
|
||||
dct = "difftool --cached";
|
||||
# -----
|
||||
f = "fetch";
|
||||
fo = "fetch origin";
|
||||
fu = "fetch upstream";
|
||||
# -----
|
||||
fp = "format-patch";
|
||||
# -----
|
||||
fk = "fsck";
|
||||
# -----
|
||||
g = "grep -p";
|
||||
# -----
|
||||
l = "log --oneline";
|
||||
lg = "log --oneline --graph --decorate";
|
||||
# -----
|
||||
ls = "ls-files";
|
||||
lsf = "!git ls-files | grep -i";
|
||||
# -----
|
||||
m = "merge";
|
||||
ma = "merge --abort";
|
||||
mc = "merge --continue";
|
||||
ms = "merge --skip";
|
||||
# -----
|
||||
o = "checkout";
|
||||
ob = "checkout -b";
|
||||
# -----
|
||||
pr = "prune -v";
|
||||
# -----
|
||||
ps = "push";
|
||||
psf = "push -f";
|
||||
psu = "push -u";
|
||||
pst = "push --tags";
|
||||
# -----
|
||||
pso = "push origin";
|
||||
psao = "push --all origin";
|
||||
psfo = "push -f origin";
|
||||
psuo = "push -u origin";
|
||||
# -----
|
||||
psom = "push origin master";
|
||||
psaom = "push --all origin master";
|
||||
psfom = "push -f origin master";
|
||||
psuom = "push -u origin master";
|
||||
psoc = "!git push origin $(git bc)";
|
||||
psaoc = "!git push --all origin $(git bc)";
|
||||
psfoc = "!git push -f origin $(git bc)";
|
||||
psuoc = "!git push -u origin $(git bc)";
|
||||
psdc = "!git push origin :$(git bc)";
|
||||
# -----
|
||||
pl = "pull";
|
||||
pb = "pull --rebase";
|
||||
# -----
|
||||
plo = "pull origin";
|
||||
pbo = "pull --rebase origin";
|
||||
plom = "pull origin master";
|
||||
ploc = "!git pull origin $(git bc)";
|
||||
pbom = "pull --rebase origin master";
|
||||
pboc = "!git pull --rebase origin $(git bc)";
|
||||
# -----
|
||||
plu = "pull upstream";
|
||||
plum = "pull upstream master";
|
||||
pluc = "!git pull upstream $(git bc)";
|
||||
pbum = "pull --rebase upstream master";
|
||||
pbuc = "!git pull --rebase upstream $(git bc)";
|
||||
# -----
|
||||
rb = "rebase";
|
||||
rba = "rebase --abort";
|
||||
rbc = "rebase --continue";
|
||||
rbi = "rebase --interactive";
|
||||
rbs = "rebase --skip";
|
||||
# -----
|
||||
re = "reset";
|
||||
rh = "reset HEAD";
|
||||
reh = "reset --hard";
|
||||
rem = "reset --mixed";
|
||||
res = "reset --soft";
|
||||
rehh = "reset --hard HEAD";
|
||||
remh = "reset --mixed HEAD";
|
||||
resh = "reset --soft HEAD";
|
||||
# -----
|
||||
r = "remote";
|
||||
ra = "remote add";
|
||||
rr = "remote rm";
|
||||
rv = "remote -v";
|
||||
rn = "remote rename";
|
||||
rp = "remote prune";
|
||||
rs = "remote show";
|
||||
rao = "remote add origin";
|
||||
rau = "remote add upstream";
|
||||
rro = "remote remove origin";
|
||||
rru = "remote remove upstream";
|
||||
rso = "remote show origin";
|
||||
rsu = "remote show upstream";
|
||||
rpo = "remote prune origin";
|
||||
rpu = "remote prune upstream";
|
||||
# -----
|
||||
rmf = "rm -f";
|
||||
rmrf = "rm -r -f";
|
||||
# -----
|
||||
s = "status";
|
||||
sb = "status -s -b";
|
||||
# -----
|
||||
sa = "stash apply";
|
||||
sc = "stash clear";
|
||||
sd = "stash drop";
|
||||
sl = "stash list";
|
||||
sp = "stash pop";
|
||||
ss = "stash save";
|
||||
ssk = "stash save -k";
|
||||
sw = "stash show";
|
||||
st = "!git stash list | wc -l 2>/dev/null | grep -oEi '[0-9][0-9]*'";
|
||||
# -----
|
||||
t = "tag";
|
||||
td = "tag -d";
|
||||
# -----
|
||||
w = "show";
|
||||
wp = "show -p";
|
||||
wr = "show -p --no-color";
|
||||
# -----
|
||||
subadd = "!sh -c 'git submodule add git://github.com/$1 $2/$(basename $1)' -";
|
||||
subup = "submodule update --init --recursive";
|
||||
subpull = "!git submodule foreach git pull --tags origin master";
|
||||
# -----
|
||||
assume = "update-index --assume-unchanged";
|
||||
unassume = "update-index --no-assume-unchanged";
|
||||
assumed = "!git ls -v | grep ^h | cut -c 3-";
|
||||
unassumeall = "!git assumed | xargs git unassume";
|
||||
assumeall = "!git status -s | awk {'print $2'} | xargs git assume";
|
||||
# -----
|
||||
bump = ''!sh -c 'git commit -am "Version bump v$1" && git psuoc && git release $1' -'';
|
||||
release = "!sh -c 'git tag v$1 && git pst' -";
|
||||
unrelease = "!sh -c 'git tag -d v$1 && git pso :v$1' -";
|
||||
merged = "!sh -c 'git o master && git plom && git bd $1 && git rpo' -";
|
||||
aliases = "!git config -l | grep alias | cut -c 7-";
|
||||
snap = "!git stash save 'snapshot = $(date)' && git stash apply 'stash@{0}'";
|
||||
bare = "!sh -c 'git symbolic-ref HEAD refs/heads/$1 && git rm --cached -r . && git clean -xfd' -";
|
||||
whois = ''!sh -c 'git log -i -1 --author="$1" --pretty="format:%an <%ae>"' -'';
|
||||
serve = "daemon --reuseaddr --verbose --base-path=. --export-all ./.git";
|
||||
# -----
|
||||
behind = "!git rev-list --left-only --count $(git bu)...HEAD";
|
||||
ahead = "!git rev-list --right-only --count $(git bu)...HEAD";
|
||||
# -----
|
||||
ours = "!f() { git checkout --ours $@ && git add $@; }; f";
|
||||
theirs = "!f() { git checkout --theirs $@ && git add $@; }; f";
|
||||
subrepo = "!sh -c 'git filter-branch --prune-empty --subdirectory-filter $1 master' -";
|
||||
human = "name-rev --name-only --refs=refs/heads/*";
|
||||
};
|
||||
settings = {
|
||||
branch = {
|
||||
autosetuprebase = "always";
|
||||
};
|
||||
color = {
|
||||
ui = "auto";
|
||||
};
|
||||
core = {
|
||||
autocrlf = "input";
|
||||
editor = "micro";
|
||||
safecrlf = "warn";
|
||||
excludesfile = "~/.gitignore_global";
|
||||
};
|
||||
diff = {
|
||||
mnemonicprefix = true;
|
||||
};
|
||||
include = {
|
||||
path = "~/.gitconfig.local";
|
||||
};
|
||||
init = {
|
||||
defaultBranch = "main";
|
||||
};
|
||||
merge = {
|
||||
conflictstyle = "diff3";
|
||||
commit = "no";
|
||||
ff = "no";
|
||||
tool = "splice";
|
||||
};
|
||||
push = {
|
||||
autoSetupRemote = true;
|
||||
default = "current";
|
||||
};
|
||||
pull = {
|
||||
default = "matching";
|
||||
autoSetupRemote = true;
|
||||
rebase = true;
|
||||
useForceIfIncludes = true;
|
||||
};
|
||||
rebase = {
|
||||
autostash = true;
|
||||
autosquash = true;
|
||||
instructionFormat = "(%an <%ae>) %s";
|
||||
updateRefs = true;
|
||||
};
|
||||
rerere = {
|
||||
enabled = true;
|
||||
};
|
||||
sequence = {
|
||||
editor = "code --wait";
|
||||
};
|
||||
signing = {
|
||||
signByDefault = true;
|
||||
inherit (_.config.meta.${config.home.username}.key);
|
||||
};
|
||||
commit = {
|
||||
gpgsign = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
18
module/aspect/software/code/version-control/github.nix
Normal file
18
module/aspect/software/code/version-control/github.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
den.aspects = {
|
||||
version-control = {
|
||||
homeManager =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
programs = {
|
||||
gh = {
|
||||
enable = true;
|
||||
extensions = [
|
||||
pkgs.gh-copilot
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
274
module/aspect/software/code/version-control/jujutsu.nix
Normal file
274
module/aspect/software/code/version-control/jujutsu.nix
Normal file
|
|
@ -0,0 +1,274 @@
|
|||
_:
|
||||
{
|
||||
den.aspects = {
|
||||
version-control = {
|
||||
homeManager =
|
||||
{ pkgs, config, ... }:
|
||||
{
|
||||
home.packages = [
|
||||
pkgs.watchman
|
||||
];
|
||||
programs = {
|
||||
jujutsu = {
|
||||
enable = true;
|
||||
settings = {
|
||||
fsmonitor = {
|
||||
backend = "watchman";
|
||||
watchman.register-snapshot-trigger = true;
|
||||
};
|
||||
snapshot.max-new-file-size = "15M";
|
||||
user = {
|
||||
inherit (_.config.meta.${config.home.username}.fullname);
|
||||
inherit (_.config.meta.${config.home.username}.email);
|
||||
};
|
||||
ui = {
|
||||
default-command = "l";
|
||||
diff-editor = ":builtin";
|
||||
graph.style = "square";
|
||||
pager = ":builtin";
|
||||
show-cryptographic-signatures = true;
|
||||
};
|
||||
git = {
|
||||
private-commits = "description(glob:'wip:*') | description(glob:'private:*')";
|
||||
auto-local-bookmark = true;
|
||||
fetch = [
|
||||
"origin"
|
||||
];
|
||||
write-change-id-header = true;
|
||||
};
|
||||
revset-aliases = {
|
||||
"immutable_heads()" = "trunk() | tags() | remote_bookmarks(remote=origin)";
|
||||
"closest_bookmark(to)" = "heads(::to & bookmarks())";
|
||||
"closest_pushable(to)" =
|
||||
"heads(::to & mutable() & ~description(exact:\"\") & (~empty() | merges()))";
|
||||
# Source: https://github.com/bryceberger/config/blob/38c6caf0823517b5423b2ca2a25f7fd79d445e0e/home/jj/config.toml
|
||||
"mine()" = "author(exact:'@name@') | author(exact:'@email@')";
|
||||
"wip()" = "description(glob:'wip:*')";
|
||||
"private()" = "description(glob:'private:*')";
|
||||
"stack()" = "ancestors(mutable() & (..@ | @::), 2)";
|
||||
"stack(x)" = "ancestors(mutable() & (..x | x::), 2)";
|
||||
"stack(x, n)" = "ancestors(mutable() & (..x | x::), n)";
|
||||
"streams()" = "heads(::@ & bookmarks())";
|
||||
"streams(x)" = "heads(::x & bookmarks())";
|
||||
"base_point(x)" = "heads(immutable_heads() & ::x)";
|
||||
"open()" = "stack(trunk().. & mine(), 2)";
|
||||
"open(n)" = "stack(trunk().. & mine(), n)";
|
||||
"why_immutable(r)" = "(r & immutable()) | roots(r:: & immutable_heads())";
|
||||
};
|
||||
revsets = {
|
||||
log = ''
|
||||
none()
|
||||
| base_point(@)
|
||||
| ancestors(@, 10) & trunk()..@
|
||||
| trunk()
|
||||
| bookmarks()
|
||||
| mutable() & visible_heads()
|
||||
| fork_point(mutable() & visible_heads())
|
||||
| (mutable() & merges())-
|
||||
'';
|
||||
short-prefixes = "stack(@)";
|
||||
};
|
||||
|
||||
template-aliases = {
|
||||
"link(target, text)" =
|
||||
''raw_escape_sequence("\x1b]8;;" ++ target ++ "\x1b\\") ++ label("text link", text) ++ raw_escape_sequence("\x1b]8;;\x1b\\")'';
|
||||
"italic(text)" = ''raw_escape_sequence("\x1b[3m") ++ text ++ raw_escape_sequence("\x1b[23m")'';
|
||||
"dim(text)" = ''raw_escape_sequence("\x1b[2m") ++ text ++ raw_escape_sequence("\x1b[22m")'';
|
||||
|
||||
"commit_description_verbose(commit)" = ''
|
||||
concat(
|
||||
commit_description(commit),
|
||||
"JJ: ignore-rest\n",
|
||||
diff.git(),
|
||||
)
|
||||
'';
|
||||
"commit_description(commit)" = ''
|
||||
concat(
|
||||
commit.description(), "\n",
|
||||
"JJ: This commit contains the following changes:\n",
|
||||
indent("JJ: ", diff.stat(72)),
|
||||
)
|
||||
'';
|
||||
|
||||
annotate_header = ''
|
||||
if(first_line_in_hunk, surround("\n", "\n", separate("\n",
|
||||
separate(" ",
|
||||
format_short_change_id_with_hidden_and_divergent_info(commit),
|
||||
format_short_id(commit.commit_id()),
|
||||
format_short_cryptographic_signature(commit.signature()),
|
||||
commit.description().first_line(),
|
||||
),
|
||||
commit_timestamp(commit).local().format('%Y-%m-%d %H:%M:%S')
|
||||
++ " "
|
||||
++ commit.author(),
|
||||
))) ++ pad_start(4, line_number) ++ ": " ++ content
|
||||
'';
|
||||
|
||||
# 00000000 ........ yyyy-mm-dd HH:MM:SS 1:
|
||||
annotate = ''
|
||||
if(first_line_in_hunk,
|
||||
separate(" ",
|
||||
format_short_id(commit.change_id()),
|
||||
pad_end(8, truncate_end(8, commit.author().email().local())),
|
||||
commit_timestamp(commit).local().format('%Y-%m-%d %H:%M:%S'),
|
||||
),
|
||||
pad_end(37, ""),
|
||||
) ++ pad_start(4, line_number) ++ ": " ++ content
|
||||
'';
|
||||
|
||||
"format_commit_info(commit)" = ''
|
||||
separate(" ",
|
||||
format_short_change_id_with_hidden_and_divergent_info(commit),
|
||||
format_short_id(commit.commit_id()),
|
||||
format_short_cryptographic_signature(commit.signature()),
|
||||
)'';
|
||||
|
||||
"format_commit_bookmarks(commit)" = ''
|
||||
separate(" ",
|
||||
commit.working_copies(),
|
||||
commit.tags(),
|
||||
commit.bookmarks(),
|
||||
)'';
|
||||
|
||||
"format_description(commit)" = ''
|
||||
separate(" ",
|
||||
if(empty, label("empty", "(empty)")),
|
||||
coalesce(
|
||||
if(commit.description(),
|
||||
truncate_end(48, commit.description().first_line(), " [...]"),
|
||||
if(!empty, label("description placeholder", "(no description)")),
|
||||
)
|
||||
)
|
||||
)'';
|
||||
|
||||
"format_author(commit)" = ''
|
||||
separate(" ",
|
||||
commit.author().email(),
|
||||
commit.author().name(),
|
||||
)
|
||||
'';
|
||||
|
||||
"format_commit_date(commit)" = ''
|
||||
separate(" ",
|
||||
commit_timestamp(commit).local().format('%Y-%m-%d %H:%M:%S'),
|
||||
)
|
||||
'';
|
||||
|
||||
default_log = ''
|
||||
separate(" ",
|
||||
format_commit_info(self),
|
||||
format_commit_bookmarks(self),
|
||||
format_description(self),
|
||||
format_author(self),
|
||||
format_commit_date(self),
|
||||
)'';
|
||||
};
|
||||
|
||||
templates = {
|
||||
draft_commit_description = "commit_description(self)";
|
||||
|
||||
file_annotate = "annotate_header";
|
||||
|
||||
log = "default_log";
|
||||
log_node = ''
|
||||
label("node", coalesce(
|
||||
if(!self, label("elided", "~")),
|
||||
label(
|
||||
separate(" ",
|
||||
if(current_working_copy, "working_copy"),
|
||||
if(conflict, "conflict"),
|
||||
if(immutable, "immutable"),
|
||||
if(description.starts_with("wip:"), "wip"),
|
||||
if(description.starts_with("private:"), "wip"),
|
||||
),
|
||||
coalesce(
|
||||
if(current_working_copy, "@"),
|
||||
if(conflict, "x"),
|
||||
if(immutable, "◆"),
|
||||
if(description.starts_with("wip:"), "!"),
|
||||
if(description.starts_with("private:"), "◇"),
|
||||
"○",
|
||||
)
|
||||
)
|
||||
))
|
||||
'';
|
||||
};
|
||||
|
||||
aliases = {
|
||||
tug = [
|
||||
"bookmark"
|
||||
"move"
|
||||
"--from"
|
||||
"closest_bookmark(@)"
|
||||
"--to"
|
||||
"closest_pushable(@)"
|
||||
];
|
||||
ds = [
|
||||
"diff"
|
||||
"--stat"
|
||||
];
|
||||
dv = [
|
||||
"--config=templates.draft_commit_description=commit_description_verbose(self)"
|
||||
"describe"
|
||||
];
|
||||
# Too slow - TODO investigate why
|
||||
# l = ["log" "-T" "builtin_log_compact"];
|
||||
# ll = ["log" "-T" "builtin_log_detailed"];
|
||||
l = [
|
||||
"log"
|
||||
"-r"
|
||||
"all()"
|
||||
];
|
||||
ll = [
|
||||
"log"
|
||||
"-r"
|
||||
"all()"
|
||||
"-T"
|
||||
"builtin_log_detailed"
|
||||
];
|
||||
xl = [
|
||||
"log"
|
||||
"-T"
|
||||
"builtin_log_detailed"
|
||||
];
|
||||
evolve = [
|
||||
"rebase"
|
||||
"--skip-empty"
|
||||
"-d"
|
||||
"main"
|
||||
];
|
||||
streams = [
|
||||
"log"
|
||||
"--no-graph"
|
||||
"-r"
|
||||
"streams()"
|
||||
"-T"
|
||||
"bookmarks.map(|b| b ++ ' ')"
|
||||
];
|
||||
open = [
|
||||
"log"
|
||||
"-r"
|
||||
"open()"
|
||||
];
|
||||
stack = [
|
||||
"log"
|
||||
"-r"
|
||||
"stack()"
|
||||
];
|
||||
s = [ "stack" ];
|
||||
yank = [
|
||||
"rebase"
|
||||
"--skip-emptied"
|
||||
"-s"
|
||||
"all:roots(mutable() & mine())"
|
||||
"-d"
|
||||
"trunk()"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
16
module/aspect/software/code/version-control/lazygit.nix
Normal file
16
module/aspect/software/code/version-control/lazygit.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
den.aspects = {
|
||||
version-control = {
|
||||
homeManager = {
|
||||
programs = {
|
||||
lazygit = {
|
||||
enable = true;
|
||||
settings = {
|
||||
git.overrideGpg = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
11
module/aspect/software/code/version-control/mergiraf.nix
Normal file
11
module/aspect/software/code/version-control/mergiraf.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
den.aspects = {
|
||||
version-control = {
|
||||
homeManager = {
|
||||
programs.mergiraf = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
den.aspects = {
|
||||
version-control = {
|
||||
homeManager =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home.packages = [
|
||||
pkgs.nixpkgs-review
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue