First commit
This commit is contained in:
31
modules/tty/config/gitprompt.sh
Normal file
31
modules/tty/config/gitprompt.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
_git () {
|
||||
if git branch --show-current > /dev/null 2>&1
|
||||
then
|
||||
_BRANCH="$(git branch --show-current)"
|
||||
_MODIFIED="$(grep -o "M" <<< "$(git status --short)" | grep -c .)"
|
||||
_UNTRACKED="$(grep -o "??" <<< "$(git status --short)" | grep -c .)"
|
||||
_ORIGIN="$(git remote show)"
|
||||
_AHEAD=$(git rev-list --left-right --count "$_BRANCH"..."$_ORIGIN"/"$_BRANCH" 2> /dev/null | cut -f 1)
|
||||
_BEHIND=$(git rev-list --left-right --count "$_BRANCH"..."$_ORIGIN"/"$_BRANCH" 2> /dev/null | cut -f 2)
|
||||
printf " %s " "$_BRANCH"
|
||||
if (( _MODIFIED == 0 )) && (( _UNTRACKED == 0 )) && (( _AHEAD == 0 )) && (( _BEHIND == 0 ))
|
||||
then
|
||||
printf " "
|
||||
exit 0
|
||||
fi
|
||||
if (( _MODIFIED > 0 ))
|
||||
then
|
||||
printf "✗%s " "$_MODIFIED"
|
||||
fi
|
||||
if (( _UNTRACKED > 0 ))
|
||||
then
|
||||
printf "★%s " "$_UNTRACKED"
|
||||
fi
|
||||
if (( _AHEAD > 0 )); then
|
||||
printf "%s " "$_AHEAD"
|
||||
fi
|
||||
if (( _BEHIND > 0 )); then
|
||||
printf "%s " "$_BEHIND"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
26
modules/tty/config/inputrc
Normal file
26
modules/tty/config/inputrc
Normal file
@@ -0,0 +1,26 @@
|
||||
set bell-style none
|
||||
set meta-flag on
|
||||
set input-meta on
|
||||
set convert-meta off
|
||||
set output-meta on
|
||||
set colored-stats on
|
||||
set completion-ignore-case on
|
||||
set editing-mode emacs
|
||||
|
||||
"\e[A":history-search-backward
|
||||
"\e[B":history-search-forward
|
||||
|
||||
$if term=linux
|
||||
"\e[1~": beginning-of-line
|
||||
"\e[4~": end-of-line
|
||||
$endif
|
||||
|
||||
$if term=xterm
|
||||
"\e[1~": beginning-of-line
|
||||
"\e[4~": end-of-line
|
||||
$endif
|
||||
|
||||
$if term=rxvt-unicode
|
||||
"\e[7~": beginning-of-line
|
||||
"\e[8~": end-of-line
|
||||
$endif
|
||||
56
modules/tty/default.nix
Normal file
56
modules/tty/default.nix
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}@attrs:
|
||||
let
|
||||
cfg = config.services.getty;
|
||||
in
|
||||
{
|
||||
programs.bash = {
|
||||
promptInit = ''
|
||||
[[ "$TERM" == "xterm-kitty" ]] && export TERM="xterm"
|
||||
|
||||
[[ -f ${pkgs.nitch}/bin/nitch ]] && nitch
|
||||
|
||||
if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
|
||||
hyprland --config /etc/xdg/hypr/hyprland.conf
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
## all tty autologin
|
||||
#services.getty.autologinUser = "beastie";
|
||||
## if all tty autologin login once
|
||||
#services.getty.autologinOnce
|
||||
## only tty1 autologin
|
||||
systemd.services."getty@tty1" = {
|
||||
overrideStrategy = "asDropin";
|
||||
serviceConfig.ExecStart = [
|
||||
""
|
||||
"${pkgs.util-linux}/bin/agetty --login-program ${cfg.loginProgram} --autologin ${attrs.username} --noclear --keep-baud %I 115200,38400,9600 $TERM"
|
||||
];
|
||||
};
|
||||
|
||||
environment = {
|
||||
systemPackages = with pkgs; [
|
||||
nitch
|
||||
];
|
||||
etc = {
|
||||
"inputrc".source = ./config/inputrc;
|
||||
};
|
||||
shellAliases = {
|
||||
ls = "ls --color=auto";
|
||||
ll = "ls --color=auto -lha";
|
||||
grep = "grep --color=auto";
|
||||
ip = "ip -color=auto";
|
||||
vi = "nvim";
|
||||
};
|
||||
variables = {
|
||||
EDITOR = "nvim";
|
||||
BROWSER = "firefox";
|
||||
HISTSIZE = 10000;
|
||||
HISTTIMEFORMAT = "%F %T ";
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user