config/users/pbsds/home/profiles/shell.nix

146 lines
4.0 KiB
Nix
Raw Normal View History

2024-06-06 21:31:22 +02:00
{ pkgs, lib, config, ... }:
2023-03-04 00:09:57 +01:00
{
# TODO: "bind -s 'set completion-ignore-case on'"
programs.bash.enable = true;
#programs.bash.enableCompletion = true;
programs.bash.shellOptions = [
# Append to history file rather than replacing it.
"histappend"
# check the window size after each command and, if
# necessary, update the values of LINES and COLUMNS.
"checkwinsize"
# Extended globbing.
"extglob"
"globstar"
# Warn if closing shell with running jobs.
"checkjobs"
];
2023-07-05 17:30:17 +02:00
programs.bash.initExtra = ''
2023-07-19 22:59:12 +02:00
bind 'set completion-ignore-case on'
2023-07-05 17:30:17 +02:00
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1='\[\033[01;32m\]\u@\h\[\033[01;37m\] \[\033[01;34m\]\W\[\033[33m\]$(parse_git_branch)\[\033[01;32m\]\$\[\033[00m\] '
# tldr
if command -v tldr >/dev/null; then
complete -F _command tldr
fi
2024-08-14 17:09:15 +02:00
destore() {
for dst in "$@"; do
test -L "$dst" || continue
# TODO: assert dst is in the store
src="$(realpath "$dst")"
if test -d "$src"; then
(set -x
rm -v "$dst"
2024-08-16 21:05:52 +02:00
cp -r --dereference --one-file-system "$src/" "$dst/"
2024-08-14 17:09:15 +02:00
chmod -R +rw "$dst"
)
elif test -f "$src"; then
(set -x
rm -v "$dst"
cp -v "$src" "$dst"
chmod -v +rw "$dst"
)
fi
done
}
2023-07-05 17:30:17 +02:00
'';
2023-03-04 00:09:57 +01:00
2023-03-04 01:48:55 +01:00
imports = [ ../modules/jump.nix ];
2024-02-11 05:00:48 +01:00
programs.jump.enableBash = true;
2023-03-04 01:48:55 +01:00
2024-02-18 22:14:40 +01:00
programs.nix-index.enable = true;
programs.nix-index-database.comma.enable = true; # via nix-index-database flake
#programs.command-not-found.enable = false; # mutex with nix-index
2023-03-04 00:09:57 +01:00
programs.fzf.enable = true; # TODO: does this conflict with system-wide setup?
2024-02-18 22:14:40 +01:00
programs.eza.enable = true;
2024-06-06 21:31:22 +02:00
programs.eza.enableAliases = lib.mkIf (lib.versionOlder config.home.version.release "24.05") true;
2024-02-18 22:14:40 +01:00
2024-04-20 00:37:07 +02:00
#programs.zoxide.enable = true;
#programs.zoxide.options = [ "--cmd cd --cmd dc" ];
2024-02-18 22:14:40 +01:00
2024-06-15 20:34:46 +02:00
programs.carapace.enable = true; # completions
2023-03-04 00:09:57 +01:00
# i can't type
2024-02-18 22:14:40 +01:00
home.shellAliases.sl = "eza";
#home.shellAliases.dc = "cd";
2023-03-04 00:09:57 +01:00
programs.direnv.enable = true;
2024-02-18 22:14:40 +01:00
programs.direnv.nix-direnv.enable = true;
2023-03-04 00:09:57 +01:00
programs.tealdeer.enable = true;
2024-02-18 22:14:40 +01:00
programs.tealdeer.settings.updates.auto_update = true;
2023-03-04 00:09:57 +01:00
# just use ncdu lol
home.shellAliases.dush = "du -shc * | sort -h";
home.shellAliases.dushd = "du -shc * .[!.]?* | sort -h";
2023-06-14 12:24:53 +02:00
home.shellAliases.open = "xdg-open";
2023-03-04 00:09:57 +01:00
home.shellAliases.diff = "diff -u --color"; # eyo
home.shellAliases.ip = "ip -br -color";
home.shellAliases.rssh = "ssh -l root";
home.shellAliases.sudo = "sudo ";
home.shellAliases.watch = "watch -c "; # parse colors
home.shellAliases.xargs = "xargs ";
2024-06-15 20:34:46 +02:00
home.shellAliases.vimv = "edir";
2024-02-18 22:14:40 +01:00
# Be conservative with files
2024-06-04 11:34:27 +02:00
# --preserver-root is for GNU versions, preventing changing perms on /
2024-02-18 22:14:40 +01:00
home.shellAliases.chown = "chown --preserve-root";
home.shellAliases.chmod = "chmod --preserve-root";
home.shellAliases.chgrp = "chgrp --preserve-root";
2024-06-04 11:34:27 +02:00
home.shellAliases.rm = "rm --preserve-root";
# prompt if deleting more than 3 files at a time
#home.shellAliases.rm = "rm -i";
#home.shellAliases.mv = "mv -i";
#home.shellAliases.cp = "cp -i";
2024-02-18 22:14:40 +01:00
2024-08-04 04:54:14 +02:00
home.shellAliases.kaomoji = "curl -s 'https://kaomoji.ru/en/' | htmlq tr td span --text | grep . | shuf | head -n1";
2024-03-23 19:33:09 +01:00
home.packages = lib.filter (x: x != null) (with pkgs; [
2023-03-04 00:09:57 +01:00
rsync
2023-07-05 13:34:19 +02:00
bind.dnsutils # dig
2023-11-10 22:55:32 +01:00
dogdns # dog
2024-06-15 20:34:46 +02:00
edir # better vimv
2023-03-04 00:09:57 +01:00
curl
wget
2024-07-31 01:57:47 +02:00
wakeonlan
2023-03-11 03:39:06 +01:00
2023-03-04 00:09:57 +01:00
#tldr
2024-08-20 03:23:38 +02:00
stress
2023-03-04 00:09:57 +01:00
entr
2023-06-24 14:48:53 +02:00
axel aria aria2
2023-03-04 00:09:57 +01:00
xe # xargs alternative
sd # sed alternative
fd # find alternative
2023-03-11 03:39:06 +01:00
silver-searcher # 'ag'
ripgrep # 'rg'
2023-10-14 18:40:32 +02:00
comby
2023-03-04 00:09:57 +01:00
gron
jq
2023-09-28 01:58:08 +02:00
fx
2023-03-11 03:39:06 +01:00
yq # includes xmlq and tomlq
fq # binary jq
2024-03-23 19:33:09 +01:00
(pkgs.jnv or unstable.jnv or null)
2023-03-04 00:09:57 +01:00
htmlq
2023-03-11 03:39:06 +01:00
just # justfile
2024-02-17 17:51:49 +01:00
gum
2023-03-04 00:09:57 +01:00
sysz
du-dust # du alternative
2024-02-18 22:14:40 +01:00
duf # df alternative
2023-03-04 00:09:57 +01:00
ncdu # Disk usage analyzer with an ncurses interface
xplr # tui file explorer
2024-02-18 22:14:40 +01:00
aha (pkgs.colorized-logs or unstable.colorized-logs)
2024-03-23 19:33:09 +01:00
]);
2023-03-04 00:09:57 +01:00
}