nix/home-manager/bash.nix
2023-08-22 21:11:46 +09:00

100 lines
No EOL
2.3 KiB
Nix

{ config, pkgs, ... }: {
# Configure BASH exports
# https://nix-community.github.io/home-manager/options.html
# https://github.com/justjanne/powerline-go
# https://nix-community.github.io/home-manager/options.html#opt-programs.powerline-go.enable
programs.powerline-go = {
enable = true;
# https://github.com/justjanne/powerline-go#customization
settings = {
hostname-only-if-ssh = true;
cwd-max-depth = 2;
condensed = true;
theme = "gruvbox";
};
modules = [
"venv"
"user"
"host"
"ssh"
"cwd"
"nix-shell"
"perms"
"git"
"docker"
"exit"
];
modulesRight = [
"root"
];
};
programs = {
bash = {
enable = true;
enableCompletion = true;
sessionVariables = {
# Set the GTK Theme
GTK_THEME = "Gruvbox-Dark-BL";
XDG_DATA_HOME = "$HOME/.local/share";
};
bashrcExtra = ''
sops-edit() {
nix-shell -p sops --run "sops $1"
}
sops-update() {
nix-shell -p sops --run "sops updatekeys $1"
}
nix-clean-all() {
nix-channel --update
nix-env -u --always
nix-collect-garbage -d
}
'';
shellAliases = {
# Disable askpass for cli auth:
SSH_ASKPASS = "";
# nVidia prime selector alias:
prime-select = "nvidia-offload";
# docker
d = "docker";
dc = "docker-compose";
de = "docker exec -it";
# bash / system
cp = "rsync -avr";
ll = "ls -lah";
rm = "rm -i";
df = "duf";
# git
g = "git";
ga = "git add -A";
gb = "git branch";
gc = "git commit";
gca = "git commit -a";
gco = "git checkout";
gd = "git diff";
gp = "git pull --prune";
gpu = "git push origin HEAD";
gs = "git status -sb";
# time / date
tdate = "date +%Y.%m.%d..%H.%M";
ttime = "date +%H.%M";
ddate = "date +%Y.%m.%d";
dday = "date +%A";
# nixos-rebuild
ns = "nix-shell -p";
nr = "nixos-rebuild";
nrs = "nixos-rebuild --upgrade switch";
nrt = "nixos-rebuild test";
nrb = "nixos-rebuild build";
};
};
};
}