refactor core into cli so it can be used from hm as well
this gives me portable shellAliases and direnv
This commit is contained in:
parent
89ee328bbd
commit
285e319681
|
@ -139,7 +139,7 @@
|
|||
importables = rec {
|
||||
profiles = digga.lib.rakeLeaves ./users/profiles;
|
||||
suites = with profiles; rec {
|
||||
hmBase = [ direnv git nvim ];
|
||||
hmBase = [ direnv git nvim cli ];
|
||||
gui = [ hmBase firefox desktop email cal ];
|
||||
work = [ hmBase firefox ];
|
||||
};
|
||||
|
|
|
@ -6,65 +6,57 @@ in
|
|||
|
||||
nix.systemFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];
|
||||
|
||||
fonts = {
|
||||
fonts = with pkgs; [ powerline-fonts dejavu_fonts ];
|
||||
fontconfig.defaultFonts = {
|
||||
monospace = [ "DejaVu Sans Mono for Powerline" ];
|
||||
sansSerif = [ "DejaVu Sans" ];
|
||||
};
|
||||
};
|
||||
|
||||
nix = {
|
||||
autoOptimiseStore = true;
|
||||
gc.automatic = true;
|
||||
optimise.automatic = true;
|
||||
useSandbox = true;
|
||||
allowedUsers = [ "@wheel" ];
|
||||
trustedUsers = [ "root" "@wheel" ];
|
||||
extraOptions = ''
|
||||
min-free = 536870912
|
||||
keep-outputs = true
|
||||
keep-derivations = true
|
||||
fallback = true
|
||||
'';
|
||||
};
|
||||
|
||||
#programs.bash = {
|
||||
# promptInit = ''
|
||||
# eval "$(starship init bash)"
|
||||
# '';
|
||||
# interactiveShellInit = ''
|
||||
# flakify() {
|
||||
# if [ ! -e flake.nix ]; then
|
||||
# nix flake new -t github:nix-community/nix-direnv .
|
||||
# elif [ ! -e .envrc ]; then
|
||||
# echo "use flake" > .envrc
|
||||
# direnv allow
|
||||
# fi
|
||||
# vim flake.nix
|
||||
# }
|
||||
|
||||
# export STARSHIP_CONFIG=${
|
||||
# pkgs.writeText "starship.toml"
|
||||
# (builtins.readFile ./starship.toml)
|
||||
# }
|
||||
|
||||
# eval "$(${pkgs.direnv}/bin/direnv hook bash)"
|
||||
# '';
|
||||
# enableCompletion = true;
|
||||
#};
|
||||
|
||||
programs.zsh.enable = true;
|
||||
|
||||
environment = {
|
||||
systemPackages = with pkgs; [
|
||||
binutils
|
||||
coreutils
|
||||
dnsutils
|
||||
dosfstools
|
||||
git
|
||||
bottom
|
||||
gptfdisk
|
||||
iputils
|
||||
jq
|
||||
manix
|
||||
moreutils
|
||||
nix-index
|
||||
cached-nix-shell
|
||||
nmap
|
||||
ripgrep
|
||||
skim
|
||||
tealdeer
|
||||
usbutils
|
||||
utillinux
|
||||
whois
|
||||
iftop
|
||||
wget
|
||||
curl
|
||||
exa
|
||||
bat
|
||||
fd
|
||||
ag
|
||||
tcpdump
|
||||
mtr
|
||||
file
|
||||
lsof
|
||||
atool
|
||||
inotify-tools
|
||||
strace
|
||||
zip
|
||||
unzip
|
||||
rsync
|
||||
tmux
|
||||
pwgen
|
||||
glow
|
||||
gitAndTools.gitFull
|
||||
pinentry_gnome
|
||||
pass
|
||||
less
|
||||
gdb
|
||||
xxd
|
||||
kitty
|
||||
taskwarrior
|
||||
gnupg
|
||||
syncthing
|
||||
dijo
|
||||
#kdeconnect
|
||||
#ssb-patchwork
|
||||
libreoffice
|
||||
fontconfig
|
||||
pandoc
|
||||
];
|
||||
|
||||
shellInit = ''
|
||||
export STARSHIP_CONFIG=${
|
||||
|
@ -77,40 +69,6 @@ in
|
|||
let ifSudo = lib.mkIf config.security.sudo.enable;
|
||||
in
|
||||
{
|
||||
# quick cd
|
||||
".." = "cd ..";
|
||||
"..." = "cd ../..";
|
||||
"...." = "cd ../../..";
|
||||
"....." = "cd ../../../..";
|
||||
|
||||
# modern cli tools
|
||||
ls = "exa";
|
||||
l = "ls";
|
||||
tree = "ls --tree";
|
||||
cat = "bat";
|
||||
unzip = "aunpack";
|
||||
copy = "xclip -selection clipboard";
|
||||
paste = "xclip -selection clipboard -o";
|
||||
|
||||
# task warrior
|
||||
t = "task";
|
||||
ta = "task add";
|
||||
tm = "task modify";
|
||||
te = "task edit";
|
||||
ts = "task sync";
|
||||
|
||||
scrot = "scrot ~/screenshots/%b%d::%H%M%S.png";
|
||||
|
||||
# git
|
||||
g = "git";
|
||||
|
||||
# grep
|
||||
grep = "rg";
|
||||
gi = "grep -i";
|
||||
|
||||
# internet ip
|
||||
myip = "dig +short myip.opendns.com @208.67.222.222 2>&1";
|
||||
|
||||
# nix
|
||||
n = "nix";
|
||||
np = "n profile";
|
||||
|
@ -128,7 +86,6 @@ in
|
|||
mn = ''
|
||||
manix "" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | sk --preview="manix '{}'" | xargs manix
|
||||
'';
|
||||
|
||||
# fix nixos-option
|
||||
nixos-option = "nixos-option -I nixpkgs=${self}/lib/compat";
|
||||
|
||||
|
@ -158,49 +115,6 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
fonts = {
|
||||
fonts = with pkgs; [ powerline-fonts dejavu_fonts ];
|
||||
fontconfig.defaultFonts = {
|
||||
monospace = [ "DejaVu Sans Mono for Powerline" ];
|
||||
sansSerif = [ "DejaVu Sans" ];
|
||||
};
|
||||
};
|
||||
|
||||
nix = {
|
||||
autoOptimiseStore = true;
|
||||
gc.automatic = true;
|
||||
optimise.automatic = true;
|
||||
useSandbox = true;
|
||||
allowedUsers = [ "@wheel" ];
|
||||
trustedUsers = [ "root" "@wheel" ];
|
||||
extraOptions = ''
|
||||
min-free = 536870912
|
||||
keep-outputs = true
|
||||
keep-derivations = true
|
||||
fallback = true
|
||||
'';
|
||||
};
|
||||
|
||||
programs.bash = {
|
||||
promptInit = ''
|
||||
eval "$(${pkgs.starship}/bin/starship init bash)"
|
||||
'';
|
||||
interactiveShellInit = ''
|
||||
flakify() {
|
||||
if [ ! -e flake.nix ]; then
|
||||
nix flake new -t github:nix-community/nix-direnv .
|
||||
elif [ ! -e .envrc ]; then
|
||||
echo "use flake" > .envrc
|
||||
direnv allow
|
||||
fi
|
||||
vim flake.nix
|
||||
}
|
||||
|
||||
eval "$(${pkgs.direnv}/bin/direnv hook bash)"
|
||||
'';
|
||||
enableCompletion = true;
|
||||
};
|
||||
|
||||
services.devmon.enable = true;
|
||||
|
||||
# For rage encryption, all hosts need a ssh key pair
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ hmUsers, ... }:
|
||||
{ hmUsers, pkgs, ... }:
|
||||
|
||||
{
|
||||
#home-manager.users = { inherit (hmUsers) anish; };
|
||||
|
@ -6,16 +6,17 @@
|
|||
users.users.anish = {
|
||||
description = "Personal user for Anish";
|
||||
hashedPassword = "MVHHpy9gbe3ow";
|
||||
shell = pkgs.zsh;
|
||||
isNormalUser = true;
|
||||
extraGroups = [ "wheel" "audio" ];
|
||||
openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDM0Zvei46x/yZl/IeBCq6+IYQQ0avulzVyBysF9cPigZMCybWRV7IEU+E3k9t6JrbdbdGfJkcZIWmsWDdKS8W8mBnZpVoT0ffLynu8JQ/TKdGm4Qv6bgUeKNrGsNv0ZPs2CDaGSLj0oJfRF7Ko10tcLP0vW+yujrh+y6TH/vVzJioaV4TGvtCUpn+wEQah9ROwPQLUUofsSWdnRsDJ/gp37zXWs4l5wyjSKtP3O9RZUP7kBekbSqEgSXiTk0oUQSVqIWl9NDiP6onk/gSOjXsR/JPqsSN/XI/c/yj6gyY0f51Ru2D7iBxuMJIJcWV+rU6coIj+ULcQWLzt/7TI8jq5AOOzI/ll4zbL24Eo84Rz+TP9tvMMhDZ0VaMN22AJ8qQEjc5P09tWKsX7Jg39XelyV1jHXncE4yvIE9F4RSCHzWCeKeXakizQNuzSaxTxIExRFYHjNW5bR6+3MTGwVrEIXU+qML+0yFTR86MT+tdY5AreAJQLwbog79O1NupeXJE= anish@curve" ];
|
||||
};
|
||||
|
||||
home-manager.users.anish.programs.git = {
|
||||
userName = "Anish Lakhwara";
|
||||
userEmail = "anish+git@lakhwara.com";
|
||||
delta.enable = true;
|
||||
};
|
||||
# home-manager.users.anish.programs.git = {
|
||||
# userName = "Anish Lakhwara";
|
||||
# userEmail = "anish+git@lakhwara.com";
|
||||
# delta.enable = true;
|
||||
# };
|
||||
|
||||
#home-manager.users.anish = { suites, ... }: {
|
||||
# imports = suites.gui;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#git
|
||||
bottom
|
||||
gptfdisk
|
||||
starship
|
||||
iputils
|
||||
jq
|
||||
manix
|
||||
|
@ -28,6 +29,8 @@
|
|||
exa
|
||||
bat
|
||||
fd
|
||||
trash-cli
|
||||
nix-index
|
||||
ag
|
||||
tcpdump
|
||||
mtr
|
||||
|
@ -42,7 +45,6 @@
|
|||
tmux
|
||||
pwgen
|
||||
glow
|
||||
gitAndTools.gitFull
|
||||
pinentry_gnome
|
||||
pass
|
||||
less
|
||||
|
@ -60,35 +62,37 @@
|
|||
pandoc
|
||||
];
|
||||
|
||||
programs.bash = {
|
||||
promptInit = ''
|
||||
eval "$(${pkgs.starship}/bin/starship init bash)"
|
||||
'';
|
||||
interactiveShellInit = ''
|
||||
flakify() {
|
||||
if [ ! -e flake.nix ]; then
|
||||
nix flake new -t github:nix-community/nix-direnv .
|
||||
elif [ ! -e .envrc ]; then
|
||||
echo "use flake" > .envrc
|
||||
direnv allow
|
||||
fi
|
||||
vim flake.nix
|
||||
}
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
|
||||
eval "$(${pkgs.direnv}/bin/direnv hook bash)"
|
||||
'';
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
|
||||
# interactiveShellInit = ''
|
||||
# flakify() {
|
||||
# if [ ! -e flake.nix ]; then
|
||||
# nix flake new -t github:nix-community/nix-direnv .
|
||||
# elif [ ! -e .envrc ]; then
|
||||
# echo "use flake" > .envrc
|
||||
# direnv allow
|
||||
# fi
|
||||
# vim flake.nix
|
||||
# }
|
||||
# '';
|
||||
sessionVariables = {
|
||||
EDITOR = "nvim";
|
||||
};
|
||||
enableCompletion = true;
|
||||
shellInit = ''
|
||||
export STARSHIP_CONFIG=${
|
||||
pkgs.writeText "starship.toml"
|
||||
(fileContents ./starship.toml)
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
shellAliases =
|
||||
let ifSudo = lib.mkIf config.security.sudo.enable;
|
||||
in
|
||||
{
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
|
||||
home.shellAliases = {
|
||||
# quick cd
|
||||
".." = "cd ..";
|
||||
"..." = "cd ../..";
|
||||
|
@ -122,51 +126,5 @@
|
|||
|
||||
# internet ip
|
||||
myip = "dig +short myip.opendns.com @208.67.222.222 2>&1";
|
||||
|
||||
# nix
|
||||
n = "nix";
|
||||
np = "n profile";
|
||||
ni = "np install";
|
||||
nr = "np remove";
|
||||
ns = "n search --no-update-lock-file";
|
||||
nf = "n flake";
|
||||
nepl = "n repl '<nixpkgs>'";
|
||||
srch = "ns nixos";
|
||||
orch = "ns override";
|
||||
nrb = ifSudo "cd /tmp; sudo nixos-rebuild switch --flake '/etc/nixos/#curve'; cd $OLDPWD";
|
||||
nrt = ifSudo "sudo nixos-rebuild test --flake '/etc/nixos/#curve'";
|
||||
nedit = "cd /etc/nixos; vim";
|
||||
ncd = "cd /etc/nixos";
|
||||
mn = ''
|
||||
manix "" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | sk --preview="manix '{}'" | xargs manix
|
||||
'';
|
||||
|
||||
# fix nixos-option
|
||||
nixos-option = "nixos-option -I nixpkgs=${self}/lib/compat";
|
||||
|
||||
# sudo
|
||||
s = ifSudo "sudo -E ";
|
||||
pls = ifSudo "s";
|
||||
si = ifSudo "sudo -i";
|
||||
se = ifSudo "sudoedit";
|
||||
|
||||
# top
|
||||
top = "btm";
|
||||
|
||||
# systemd
|
||||
ctl = "systemctl";
|
||||
stl = ifSudo "s systemctl";
|
||||
utl = "systemctl --user";
|
||||
ut = "systemctl --user start";
|
||||
un = "systemctl --user stop";
|
||||
up = ifSudo "s systemctl start";
|
||||
dn = ifSudo "s systemctl stop";
|
||||
jtl = "journalctl";
|
||||
|
||||
# quick ssh
|
||||
sm = "ssh 10.0.69.4";
|
||||
ss = "ssh sealight.xyz";
|
||||
sc = "ssh lakhwara.com"; # cube
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
emails = !git log --format="%aE" | sort -u
|
||||
email-domains = !git log --format="%aE" | awk -F'@' '{print $2}' | sort -u
|
||||
# pretty log
|
||||
ls = log --graph --abbrev-commit --decorate --color=always --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) - %C(dim red)%an%C(reset)%C(bold yellow)%d%C(reset)' --all
|
||||
ls = !git log --graph --abbrev-commit --decorate --color=always --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) - %C(dim red)%an%C(reset)%C(bold yellow)%d%C(reset)' --all
|
||||
[filter "lfs"]
|
||||
required = true
|
||||
smudge = git-lfs smudge -- %f
|
||||
|
|
|
@ -1,14 +1,45 @@
|
|||
{
|
||||
xdg.configFile = {
|
||||
"git/config".source = ./config;
|
||||
"git/ignore".source = ./ignore;
|
||||
"git/attributes".source = ./attributes;
|
||||
};
|
||||
#xdg.configFile = {
|
||||
# "git/config".source = ./config;
|
||||
# "git/ignore".source = ./ignore;
|
||||
# "git/attributes".source = ./attributes;
|
||||
#};
|
||||
|
||||
programs.lazygit.enable = true;
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = "Anish Lakhwara";
|
||||
userEmail = "anish+git@lakhwara.com";
|
||||
delta.enable = true;
|
||||
|
||||
ignores = [
|
||||
"*~"
|
||||
"*.*~"
|
||||
"\\#*"
|
||||
".\\#*"
|
||||
"*.swp"
|
||||
".*.sw[a-z]"
|
||||
"*.un~"
|
||||
".netrwhist"
|
||||
".vim/*"
|
||||
".DS_Store?"
|
||||
".DS_Store"
|
||||
".CFUserTextEncoding"
|
||||
".Trash"
|
||||
".Xauthority"
|
||||
"thumbs.db"
|
||||
"Thumbs.db"
|
||||
"Icon?"
|
||||
".ccls-cache/"
|
||||
".sass-cache/"
|
||||
"__pycache__/"
|
||||
"*.class"
|
||||
"*.exe"
|
||||
"*.o"
|
||||
"*.pyc"
|
||||
"*.elc"
|
||||
];
|
||||
|
||||
extraConfig = {
|
||||
pull.rebase = false;
|
||||
|
@ -19,7 +50,7 @@
|
|||
co = "checkout";
|
||||
cob = "checkout -b";
|
||||
f = "fetch -p";
|
||||
c = "commit";
|
||||
c = "commit -v";
|
||||
p = "push";
|
||||
ba = "branch -a";
|
||||
bd = "branch -d";
|
||||
|
@ -45,6 +76,8 @@
|
|||
tlog =
|
||||
"log --stat --since='1 Day Ago' --graph --pretty=oneline --abbrev-commit --date=relative";
|
||||
rank = "shortlog -sn --no-merges";
|
||||
authors = "authors | sort | uniq -c | sort -n";
|
||||
ls = "log --graph --abbrev-commit --decorate --color=always --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) - %C(dim red)%an%C(reset)%C(bold yellow)%d%C(reset)' --all";
|
||||
|
||||
# delete merged branches
|
||||
bdm = "!git branch --merged | grep -v '*' | xargs -n 1 git branch -d";
|
||||
|
|
|
@ -180,6 +180,7 @@ in
|
|||
map <leader>q :q<CR>
|
||||
map <leader>r :RainbowParenthesesToggleAll<CR>
|
||||
map <leader><BS> :noh<CR>
|
||||
map Q <Nop>
|
||||
nnoremap Y y$
|
||||
" center moving
|
||||
nnoremap n nzzzv
|
||||
|
|
Loading…
Reference in a new issue