Compare commits
2 Commits
7d927ede86
...
6a9cd5b5d2
Author | SHA1 | Date |
---|---|---|
Tim Van Baak | 6a9cd5b5d2 | |
Tim Van Baak | d162e2262b |
|
@ -0,0 +1,26 @@
|
||||||
|
# Set the title bar to user@host: pwd
|
||||||
|
_TITLE_BAR="\u@\h: \w"
|
||||||
|
_SET_TITLE_BAR="\[\e]0;$_TITLE_BAR\a\]"
|
||||||
|
# Shorten $HOME to ~ in PWD
|
||||||
|
_pwd_home () {
|
||||||
|
if [[ "$PWD" =~ ^"$HOME"(/|$) ]]; then
|
||||||
|
echo "~${PWD#$HOME}"
|
||||||
|
else
|
||||||
|
echo $PWD
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
# Shorten path dir names
|
||||||
|
_pwd () {
|
||||||
|
DIR=$(_pwd_home)
|
||||||
|
[ "$DIR" != "/" ] && [ "$DIR" != "~" ] && printf '%s/' $(dirname $DIR | tr / '\n' | cut -c-1)
|
||||||
|
printf $(basename $DIR)
|
||||||
|
}
|
||||||
|
_DIR='$(_pwd)'
|
||||||
|
# Color codes
|
||||||
|
_GREEN="\[\033[1;32m\]"
|
||||||
|
_DIM="\[\e[92;2m\]"
|
||||||
|
_RESET="\[\e[0m\]"
|
||||||
|
# Nested shell level
|
||||||
|
_SHLVL=$(printf '\$%.0s' $(seq 1 $SHLVL))
|
||||||
|
# Build prompt
|
||||||
|
export PS1="$_SET_TITLE_BAR$_DIM[\A \u@\h:$_RESET$_GREEN$_DIR$_RESET$_DIM]$_SHLVL$_RESET "
|
|
@ -55,14 +55,18 @@ in {
|
||||||
nix.extraOptions = "experimental-features = nix-command flakes";
|
nix.extraOptions = "experimental-features = nix-command flakes";
|
||||||
# Link /etc/nixos to the flake source
|
# Link /etc/nixos to the flake source
|
||||||
environment.etc.nixos.source = ./..;
|
environment.etc.nixos.source = ./..;
|
||||||
|
environment.etc."bashrc.local".source = ./bashrc;
|
||||||
environment.shellAliases = {
|
environment.shellAliases = {
|
||||||
# Shortcut for nixos-rebuild
|
# Shortcut for nixos-rebuild
|
||||||
nr = "sudo nixos-rebuild --fast --flake $HOME/nixos-configs";
|
nr = "sudo nixos-rebuild --fast --flake $HOME/nixos-configs";
|
||||||
# Set some user-friendly defaults (use e.g. "command cp" to skip the alias)
|
# Always preserve mode, ownership, ts with copy
|
||||||
# -r (recursively copy dirs) -p (preserve mode, ownership, timestamps)
|
|
||||||
cp = "cp -rp";
|
cp = "cp -rp";
|
||||||
xo = "xdg-open";
|
xo = "xdg-open";
|
||||||
smv = "rsync -v --remove-source-files";
|
smv = "rsync -v --remove-source-files";
|
||||||
|
".." = "cd ..";
|
||||||
|
"..." = "cd ../..";
|
||||||
|
"...." = "cd ../../..";
|
||||||
|
"....." = "cd ../../../..";
|
||||||
};
|
};
|
||||||
security.sudo.extraRules = [{
|
security.sudo.extraRules = [{
|
||||||
users = [ "tvb" ];
|
users = [ "tvb" ];
|
||||||
|
|
Loading…
Reference in New Issue