big refactor

This commit is contained in:
Asaki Yuki 2026-04-09 10:36:32 +07:00
commit 76d68230f6
81 changed files with 3065 additions and 0 deletions

View file

@ -0,0 +1,62 @@
{ lib, osconfig, ... }: {
programs.bash = {
enable = true;
shellAliases = {
cls = "clear";
cleanup = "sudo nix-collect-garbage -d";
cls-log = "sudo journalctl --vacuum-time=1s";
logout = "pkill -KILL -u $USER";
nrs = "sudo nixos-rebuild switch --flake /etc/nixos#${osconfig.device.flake-name}";
wss = "waydroid session stop; exit;";
flake-upgrade = "nix flake update";
spf = "superfile";
};
shellOptions = [
"histappend"
"checkwinsize"
"extglob"
"globstar"
"checkjobs"
"autocd"
];
initExtra = ''
function git-commit() {
git add .
git commit -m "$1"
}
function git-push() {
git-commit "$1"
git push origin HEAD
}
function git-pull() {
git fetch origin HEAD
git pull origin HEAD
}
function get-hash() {
nix hash to-sri --type sha256 $(nix-prefetch-url --unpack "$1")
}
'' +
lib.optionalString osconfig.device.programs.tmux.enable ''
allowed_terms=("xterm-kitty" "xterm-ghostty")
should_run_tmux=false
for term in "${"$" + "{allowed_terms[@]" + "}"}"; do
if [[ "$TERM" == "$term" ]]; then
should_run_tmux=true
break
fi
done
if [ -z "$TMUX" ] && [ "$should_run_tmux" = true ]; then
exec tmux
fi
'';
};
}