Skip to content

Commit b4dd15a

Browse files
committed
Update git aliases, add lazygit
1 parent 2a518a6 commit b4dd15a

File tree

5 files changed

+46
-28
lines changed

5 files changed

+46
-28
lines changed

modules/profiles/home/git/common.nix

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,47 @@
44
programs.git = {
55
enable = true;
66

7-
settings = let
8-
delta = lib.getExe pkgs.delta;
9-
git = lib.getExe config.programs.git.package;
10-
fzf = lib.getExe pkgs.fzf;
11-
gh = lib.getExe pkgs.gh;
12-
superprune = pkgs.writeShellScript "git-alias-superprune" ''
13-
echo 'Fetching remote then deleting branches that are gone. This may take a moment'
14-
15-
${git} fetch -p
16-
17-
gone=$(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | awk '$2 == "[gone]" {sub("refs/heads/", "", $1); print $1}')
18-
for branch in $gone; do
19-
${git} branch -D $branch;
20-
done;
21-
'';
22-
co = pkgs.writeShellScript "git-alias-co" ''
23-
${git} checkout "$(${git} branch --sort="-committerdate" | ${fzf} | tr -d '[:space:]')";
24-
'';
25-
wipe = pkgs.writeShellScript "git-alias-wipe" ''
26-
${git} add .
27-
${git} stash
28-
'';
7+
settings = let delta = lib.getExe pkgs.delta;
298
in {
309
user.name = "Ethan Turkeltaub";
3110

32-
alias = {
11+
alias = let
12+
gh = lib.getExe pkgs.gh;
13+
mkGitShellScript = { name, text, extraRuntimeInputs ? [ ] }:
14+
lib.getExe (pkgs.writeShellApplication {
15+
inherit name text;
16+
17+
runtimeInputs = [ config.programs.git.package ]
18+
++ extraRuntimeInputs;
19+
});
20+
superprune = mkGitShellScript {
21+
name = "git-alias-superprune";
22+
text = ''
23+
echo 'Fetching remote then deleting branches that are gone. This may take a moment'
24+
25+
git fetch -p
26+
27+
gone=$(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | awk '$2 == "[gone]" {sub("refs/heads/", "", $1); print $1}')
28+
for branch in $gone; do
29+
git branch -D "$branch";
30+
done;
31+
'';
32+
};
33+
co = mkGitShellScript {
34+
name = "git-alias-co";
35+
extraRuntimeInputs = [ pkgs.fzf ];
36+
text = ''
37+
git checkout "$(git branch --sort="-committerdate" | fzf | tr -d '[:space:]')";
38+
'';
39+
};
40+
wipe = mkGitShellScript {
41+
name = "git-alias-wipe";
42+
text = ''
43+
git add .
44+
git stash
45+
'';
46+
};
47+
in {
3348
s = "status";
3449
superprune = "!sh ${superprune}";
3550
co = "!sh ${co}";

modules/profiles/home/lazygit.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
programs.lazygit = {
3+
enable = true;
4+
enableFishIntegration = true;
5+
};
6+
}

modules/profiles/home/tools/common.nix

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,5 @@
2626

2727
# Alias `man` to `batman`
2828
man = lib.getExe' pkgs.bat-extras.batman "batman";
29-
30-
# Alias `ctop` to use correct `$TERM`
31-
ctop =
32-
''TERM="(string-replace tmux screen $TERM)" ${lib.getExe pkgs.ctop}'';
3329
};
3430
}

modules/suites/home.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ with profiles;
1313
fzf
1414
ghostty
1515
helix
16+
lazygit
1617
navi
1718
paths
1819
rippkgs

users/et/profiles/tools.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{ pkgs, ... }: {
2-
home.packages = with pkgs; [ graphite-cli fnm mkcert ];
2+
home.packages = with pkgs; [ fnm mkcert ];
33

44
programs.fish.interactiveShellInit = let fnm = pkgs.lib.getExe pkgs.fnm;
55
in ''

0 commit comments

Comments
 (0)