helm/home/profiles/cli/default.nix

333 lines
8.2 KiB
Nix
Raw Normal View History

2022-12-06 06:52:15 -08:00
{ lib, pkgs, config, ... }:
2022-09-18 15:13:50 -07:00
{
home.packages = with pkgs; [
binutils
coreutils
dnsutils
dasht
2022-09-18 15:13:50 -07:00
dosfstools
#git
2024-07-14 20:21:12 -07:00
git-machete
2022-09-18 15:13:50 -07:00
bottom
gptfdisk
starship
iputils
jq
manix
moreutils
nix-index
cached-nix-shell
nmap
ripgrep
skim
tealdeer
usbutils
utillinux
whois
iftop
wget
curl
2024-03-15 23:25:49 -07:00
eza
2022-09-18 15:13:50 -07:00
bat
fd
ncdu
2024-03-15 23:25:49 -07:00
du-dust
# dia-cli
2022-09-18 15:13:50 -07:00
duf
trash-cli
nix-index
silver-searcher
tcpdump
mtr
file
lsof
atool
strace
zip
unzip
rsync
tmux
pwgen
glow
pass
less
gdb
xxd
taskwarrior
gnupg
syncthing
dijo
#ssb-patchwork
fontconfig
pandoc
2023-01-10 03:19:46 -08:00
taskwarrior-tui
2023-05-15 07:21:13 -07:00
python3Packages.howdoi
vimwiki-cli
2023-01-10 03:19:46 -08:00
2022-10-03 06:59:21 -07:00
(pkgs.writeScriptBin "jq-repl" ''
#!/usr/bin/env bash
2022-12-26 20:25:43 -08:00
if [[ -z $1 ]] || [[ $1 == "-" ]]; then
2022-10-03 06:59:21 -07:00
input=$(mktemp)
trap "rm -f $input" EXIT
cat /dev/stdin > $input
else
input=$1
fi
echo "" \ | fzf --phony --preview-window="up:90%" --print-query --preview "jq --color-output -r {q} $input"
'')
2023-05-23 04:28:49 -07:00
(pkgs.writeScriptBin "clear-vim-trash" (builtins.readFile ./bin/clear-vim-trash.sh))
2022-12-26 20:25:43 -08:00
(pkgs.writeScriptBin "flakify" ''
#!/usr/bin/env zsh
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
'')
(pkgs.writeScriptBin "mx" ''
#!/usr/bin/env bash
manix "" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --preview="manix '{}'" | xargs manix
'')
2023-01-02 01:58:34 -08:00
(pkgs.writeScriptBin "monitor" ''
connect() {
# Turn it on if it was off
xrandr --output HDMI-2 --auto
xrandr --output HDMI-2 --same-as eDP-1
}
disconnect() {
xrandr --output HDMI-2 --off
}
xrandr | grep "HDMI-2 connected" &>>/dev/null && connect || disconnect
'')
2024-11-27 23:19:50 -08:00
(pkgs.writeScriptBin "big-monitor" ''
connect() {
# Turn it on if it was off
xrandr --output HDMI-2 --auto --primary
# Disable normal display
xrandr --output eDP-1 --off
# Use a nice background
feh --bg-scale ~/Downloads/stephen-walker-onIXxjH56AA-unsplash.jpg
# Reload Polybar
~/.config/bspwm/rc.d/polybar
}
disconnect() {
xrandr --output HDMI-2 --off
}
xrandr | grep "HDMI-2 connected" &>>/dev/null && connect || disconnect
'')
2023-01-02 01:58:34 -08:00
(pkgs.writeScriptBin "disconnect-keyboard" ''
# keyboard on curve is busted
get_keyboard_id() {
xinput list | grep 'AT Translated Set' | cut -f2 | cut -d'=' -f2 | xinput float
}
disconnect_keyboard() {
id=$(get_keyboard_id)
xinput float $id
unset id
}
attach_keyboard() {
id=$(get_keyboard_id)
xinput reattach $id 3
unset id
}
disconnect_keyboard
'')
2022-09-18 15:13:50 -07:00
];
programs.zsh = {
enable = true;
enableCompletion = true;
2024-08-19 21:29:41 -07:00
autosuggestion.enable = false;
2022-09-18 15:13:50 -07:00
initExtra = ''
bindkey -v
autopair-init
'';
sessionVariables = {
EDITOR = "nvim";
TERMINFO_DIRS = "${pkgs.kitty.terminfo.outPath}/share/terminfo"; # Needed to run home-manager switch on non-nixOS
};
plugins = [
{
name = "zsh-autopair";
src = pkgs.fetchFromGitHub {
owner = "hlissner";
repo = "zsh-autopair";
rev = "34a8bca0c18fcf3ab1561caef9790abffc1d3d49";
sha256 = "1h0vm2dgrmb8i2pvsgis3lshc5b0ad846836m62y8h3rdb3zmpy1";
};
file = "autopair.zsh";
}
{
name = "zsh-syntax-highlighting";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-syntax-highlighting";
rev = "0.6.0";
sha256 = "0zmq66dzasmr5pwribyh4kbkk23jxbpdw4rjxx0i7dx8jjp2lzl4";
};
file = "zsh-syntax-highlighting.zsh";
}
{
name = "zsh-autoquoter";
src = pkgs.fetchFromGitHub {
owner = "ianthehenry";
repo = "zsh-autoquoter";
rev = "819a615fbfd2ad25c5d311080e3a325696b45de7";
sha256 = "r0jdo+YFTOejvNMTqzXi5ftcLzDpuKejX0wMFwqKdJY=";
};
file = "zsh-autoquoter.zsh";
}
2022-12-26 20:25:43 -08:00
# {
# name = "zsh-nix-shell";
# file = "nix-shell.plugin.zsh";
# src = pkgs.fetchFromGitHub {
# owner = "chisui";
# repo = "zsh-nix-shell";
# rev = "v0.5.0";
# sha256 = "0za4aiwwrlawnia4f29msk822rj9bgcygw6a8a6iikiwzjjz0g91";
# };
# }
2022-09-18 15:13:50 -07:00
];
};
programs.starship = {
enable = true;
enableZshIntegration = true;
};
programs.fzf = {
enable = true;
enableZshIntegration = true;
};
programs.direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
};
programs.zoxide = {
enable = true;
enableZshIntegration = true;
};
services.kdeconnect.enable = true;
home.shellAliases = {
# quick cd
".." = "cd ..";
"..." = "cd ../..";
"...." = "cd ../../..";
"....." = "cd ../../../..";
2022-12-26 20:25:43 -08:00
icat = "kitty +kitten icat";
yt = "ytfzf -T kitty -t ";
2023-05-13 21:42:29 -07:00
gen-secret = "< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c\${1:-32};echo;";
2022-09-18 15:13:50 -07:00
# modern cli tools
2024-03-15 23:25:49 -07:00
ls = "eza --icons";
l = "esa -l --icons";
la = "eza -la --icons";
2022-09-18 15:13:50 -07:00
tree = "ls --tree --icons";
cat = "bat";
unzip = "aunpack";
copy = "xclip -selection clipboard";
paste = "xclip -selection clipboard -o";
rm = "echo USE TRASH, FOOL: trash ";
trash = "trash-put";
2022-10-10 05:34:48 -07:00
make-secret = "< /dev/urandom \\tr -dc _A-Za-z0-9 | head -c \${1:-32};echo;";
2022-09-18 15:13:50 -07:00
# task warrior
2024-01-05 23:43:01 -08:00
t = "task -BLOCKED -idea -backlog";
2024-03-15 23:25:49 -07:00
tw = "t rc.context:work";
# TODO find a reasonable way to manage this from a non-nix managed file in ~/.task/context or something
# we can do something like task rc.context:$(cat ~/.task/context) to read context
# and write a little script make-context = cat $@ > ~/.task/context or something
2023-08-12 16:59:33 -07:00
tt = "taskwarrior-tui -r list";
ti = "task +idea";
2024-01-05 23:43:01 -08:00
tb = "task +backlog list";
2023-08-12 16:59:33 -07:00
ttb = "taskwarrior-tui -r backlog";
2022-09-18 15:13:50 -07:00
tr = "task newest limit:page";
2024-03-15 23:25:49 -07:00
twait = "task +wait";
2022-10-04 06:13:23 -07:00
ta = "task add";
2023-08-12 16:59:33 -07:00
tai = "task add +idea";
2022-09-18 15:13:50 -07:00
tn = "task-note";
ts = "task sync";
# taskwarrior task lists
2023-08-12 16:59:33 -07:00
twt = "task tags +PENDING | tail -n +4 | cut -d ' ' -f1 | fzf --preview 'task +{}'";
# task warrior projects list
tp = "task projects +PENDING | tail -n +4 | head -n -2 | cut -d ' ' -f1 | fzf --preview 'task pro:{}'";
2022-09-18 15:13:50 -07:00
2022-10-04 06:13:23 -07:00
# keeping for posterity but now sxhkbd handles screenshot with <Super+O>
# scrot = "flameshot screen -c -p ~/screenshots/";
# scrotgui = "flameshot gui -p ~/screenshots/";
2022-09-18 15:13:50 -07:00
# 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";
ni = "np install";
nr = "np remove";
ns = "n search --no-update-lock-file";
nf = "n flake";
nfl = "nf lock";
nepl = "n repl '<nixpkgs>'";
2022-12-26 20:25:43 -08:00
srch = "ns nixpkgs";
2022-09-18 15:13:50 -07:00
orch = "ns override";
2023-01-10 03:19:46 -08:00
nrb = "cd /tmp; sudo nixos-rebuild switch --flake '/home/anish/usr/helm#curve'; cd $OLDPWD";
nrt = "cd /tmp; sudo nixos-rebuild test --flake '/home/anish/usr/helm#curve'; cd $OLDPWD";
ned = "cd /home/anish/usr/helm; vim; cd $OLDPWD";
ncd = "cd /home/anish/usr/helm";
2022-09-18 15:13:50 -07:00
mn = ''
manix "" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | sk --preview="manix '{}'" | xargs manix
'';
# sudo
s = "sudo -E ";
pls = "s";
si = "sudo -i";
se = "sudoedit";
# top
top = "btm";
# systemd
ctl = "systemctl";
stl = "s systemctl";
utl = "systemctl --user";
ut = "systemctl --user start";
un = "systemctl --user stop";
up = "s systemctl start";
dn = "s systemctl stop";
jtl = "journalctl";
# quick ssh
2023-05-30 05:24:26 -07:00
kssh = "kitty +kitten ssh";
2022-09-18 15:13:50 -07:00
smm = "ssh 10.0.69.4"; # box over wireguard
sm = "ssh mossnet.lan"; # box regular
sl = "ssh sealight.xyz"; # lituus
sh = "ssh git.sealight.xyz"; # helix
sb = "ssh cyberian@69.61.38.246"; # bonfire for allwell
2022-09-18 15:13:50 -07:00
};
}