move git stuff to modules

This commit is contained in:
Noah Masur 2022-04-28 19:20:46 -04:00
parent 4ccbd8b393
commit eadec0c699
6 changed files with 88 additions and 72 deletions

View File

@ -38,6 +38,9 @@
./nixos/home.nix ./nixos/home.nix
./modules/applications/firefox.nix ./modules/applications/firefox.nix
./modules/shell/fish.nix ./modules/shell/fish.nix
./modules/shell/utilities.nix
./modules/shell/git.nix
./modules/shell/github.nix
./modules/editor/neovim.nix ./modules/editor/neovim.nix
./modules/applications/alacritty.nix ./modules/applications/alacritty.nix
]; ];

View File

@ -33,43 +33,6 @@
tan = "tmux attach-session -t noah"; tan = "tmux attach-session -t noah";
tnn = "tmux new-session -s noah"; tnn = "tmux new-session -s noah";
# Git
g = "git";
gs = "git status";
gd = "git diff";
gds = "git diff --staged";
gdp = "git diff HEAD^";
ga = "git add";
gaa = "git add -A";
gac = "git commit -am";
gc = "git commit -m";
gca = "git commit --amend --no-edit";
gcae = "git commit --amend";
gu = "git pull";
gp = "git push";
gpp = "git_set_upstream";
gl = "git log --graph --decorate --oneline -20";
gll = "git log --graph --decorate --oneline";
gco = "git checkout";
gcom = "git switch master";
gcob = "git switch -c";
gb = "git branch";
gbd = "git branch -d";
gbD = "git branch -D";
gr = "git reset";
grh = "git reset --hard";
gm = "git merge";
gcp = "git cherry-pick";
cdg = "cd (git rev-parse --show-toplevel)";
# GitHub
ghr = "gh repo view -w";
gha =
"gh run list | head -1 | awk '{ print $(NF-2) }' | xargs gh run view";
grw = "gh run watch";
grf = "gh run view --log-failed";
grl = "gh run view --log";
# Vim # Vim
v = "vim"; v = "vim";
vl = "vim -c 'normal! `0'"; vl = "vim -c 'normal! `0'";

43
modules/shell/git.nix Normal file
View File

@ -0,0 +1,43 @@
{ config, pkgs, ... }: {
programs.git = {
enable = true;
userName = "${config.fullName}";
userEmail = "7386960+nmasur@users.noreply.github.com";
extraConfig = {
pager = { branch = "false"; };
safe = { directory = "${config.dotfiles}"; };
};
};
programs.fish.shellAbbrs = {
g = "git";
gs = "git status";
gd = "git diff";
gds = "git diff --staged";
gdp = "git diff HEAD^";
ga = "git add";
gaa = "git add -A";
gac = "git commit -am";
gc = "git commit -m";
gca = "git commit --amend --no-edit";
gcae = "git commit --amend";
gu = "git pull";
gp = "git push";
gpp = "git_set_upstream";
gl = "git log --graph --decorate --oneline -20";
gll = "git log --graph --decorate --oneline";
gco = "git checkout";
gcom = "git switch master";
gcob = "git switch -c";
gb = "git branch";
gbd = "git branch -d";
gbD = "git branch -D";
gr = "git reset";
grh = "git reset --hard";
gm = "git merge";
gcp = "git cherry-pick";
cdg = "cd (git rev-parse --show-toplevel)";
};
}

19
modules/shell/github.nix Normal file
View File

@ -0,0 +1,19 @@
{ config, pkgs, ... }: {
imports = [ ./git.nix ];
programs.gh = {
enable = true;
enableGitCredentialHelper = true;
settings.git_protocol = "https";
};
programs.fish.shellAbbrs = {
ghr = "gh repo view -w";
gha = "gh run list | head -1 | awk '{ print $(NF-2) }' | xargs gh run view";
grw = "gh run watch";
grf = "gh run view --log-failed";
grl = "gh run view --log";
};
}

View File

@ -0,0 +1,22 @@
{ config, pkgs, ... }: {
home.packages = with pkgs; [
unzip
rsync
fzf
ripgrep
bat
fd
exa
sd
zoxide
jq
tealdeer
gh
direnv
tree
htop
glow
];
}

View File

@ -2,7 +2,6 @@
let let
name = "Noah Masur";
editor = "nvim"; editor = "nvim";
font = "Victor Mono"; font = "Victor Mono";
dotfiles = builtins.toString ../.; dotfiles = builtins.toString ../.;
@ -24,6 +23,7 @@ let
in { in {
options = with lib; { options = with lib; {
user = mkOption { default = "noah"; }; user = mkOption { default = "noah"; };
fullName = mkOption { default = "Noah Masur"; };
font = mkOption { default = font; }; font = mkOption { default = font; };
nixos_config = mkOption { default = nixos_config; }; nixos_config = mkOption { default = nixos_config; };
dotfiles = mkOption { default = dotfiles; }; dotfiles = mkOption { default = dotfiles; };
@ -43,24 +43,6 @@ in {
zathura # PDF viewer zathura # PDF viewer
qbittorrent qbittorrent
# Utilities
unzip
rsync
fzf
ripgrep
bat
fd
exa
sd
zoxide
jq
tealdeer
gh
direnv
tree
htop
glow
# Encryption # Encryption
gnupg gnupg
pass pass
@ -95,22 +77,6 @@ in {
config = { whitelist = { prefix = [ "${dotfiles}/" ]; }; }; config = { whitelist = { prefix = [ "${dotfiles}/" ]; }; };
}; };
programs.git = {
enable = true;
userName = "${name}";
userEmail = "7386960+nmasur@users.noreply.github.com";
extraConfig = {
pager = { branch = "false"; };
safe = { directory = "${dotfiles}"; };
};
};
programs.gh = {
enable = true;
enableGitCredentialHelper = true;
settings.git_protocol = "https";
};
# Email # Email
# programs.himalaya = { # programs.himalaya = {
# enable = true; # enable = true;