mirror of
https://github.com/itme-brain/nixos.git
synced 2026-03-24 00:29:43 -04:00
added optional gui checks for bash prompt
This commit is contained in:
parent
df6e65c534
commit
6ac3d1b33a
3 changed files with 26 additions and 4 deletions
|
|
@ -10,11 +10,13 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
users.mutableUsers = false;
|
||||||
users.users = {
|
users.users = {
|
||||||
${config.user.name} = {
|
${config.user.name} = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
extraGroups = config.user.groups;
|
extraGroups = config.user.groups;
|
||||||
openssh.authorizedKeys.keys = [ "${config.user.sshKeys.key1}" ];
|
openssh.authorizedKeys.keys = [ "${config.user.sshKeys.key1}" ];
|
||||||
|
initialPassword = "123";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
git = config.modules.user.git;
|
git = config.modules.user.git;
|
||||||
|
gui = config.modules.user.gui.sway;
|
||||||
|
|
||||||
in
|
in
|
||||||
''
|
''
|
||||||
|
|
@ -26,9 +27,15 @@ remove_icon() {
|
||||||
venv_icons=''${venv_icons//$icon/}
|
venv_icons=''${venv_icons//$icon/}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
${if gui.enable then ''
|
||||||
python_icon="\[\033[01;33m\]\[\033[00m\]"
|
python_icon="\[\033[01;33m\]\[\033[00m\]"
|
||||||
node_icon="\[\033[01;93m\]\[\033[00m\]"
|
node_icon="\[\033[01;93m\]\[\033[00m\]"
|
||||||
nix_icon="\[\033[01;34m\]\[\033[00m\]"
|
nix_icon="\[\033[01;34m\]\[\033[00m\]"
|
||||||
|
'' else ''
|
||||||
|
python_icon="\[\033[01;33m\]venv\[\033[00m\]"
|
||||||
|
node_icon="\[\033[01;93m\]js\[\033[00m\]"
|
||||||
|
nix_icon="\[\033[01;34m\]nix[\033[00m\]"
|
||||||
|
''}
|
||||||
|
|
||||||
check_venv() {
|
check_venv() {
|
||||||
if [ -n "$IN_NIX_SHELL" ]; then
|
if [ -n "$IN_NIX_SHELL" ]; then
|
||||||
|
|
@ -50,17 +57,23 @@ check_venv() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
${if gui.enable then ''
|
||||||
|
project_icon=""
|
||||||
|
'' else ''
|
||||||
|
project_icon="\[\033[01;34m\]git>[\033[00m\]"
|
||||||
|
|
||||||
|
''}
|
||||||
set_git_dir() {
|
set_git_dir() {
|
||||||
local superproject_root=$(git rev-parse --show-superproject-working-tree 2>/dev/null)
|
local superproject_root=$(git rev-parse --show-superproject-working-tree 2>/dev/null)
|
||||||
if [[ -n "$superproject_root" ]]; then
|
if [[ -n "$superproject_root" ]]; then
|
||||||
local submodule_name=$(basename "$git_root")
|
local submodule_name=$(basename "$git_root")
|
||||||
|
|
||||||
working_dir="\[\033[01;34m\] ''${superproject_root##*/}/$submodule_name$git_curr_dir\[\033[00m\]"
|
working_dir="\[\033[01;34m\]$project_icon ''${superproject_root##*/}/$submodule_name$git_curr_dir\[\033[00m\]"
|
||||||
elif [ "$git_curr_dir" == "." ]; then
|
elif [ "$git_curr_dir" == "." ]; then
|
||||||
working_dir="\[\033[01;34m\] $git_root_dir\[\033[00m\]"
|
working_dir="\[\033[01;34m\]$project_icon $git_root_dir\[\033[00m\]"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
working_dir="\[\033[01;34m\] $git_root_dir$git_curr_dir\[\033[00m\]"
|
working_dir="\[\033[01;34m\]$project_icon $git_root_dir$git_curr_dir\[\033[00m\]"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
@ -81,7 +94,11 @@ check_project() {
|
||||||
local git_curr_dir=$(relative_path "." "$git_root")
|
local git_curr_dir=$(relative_path "." "$git_root")
|
||||||
local git_root_dir=$(basename "$git_root")
|
local git_root_dir=$(basename "$git_root")
|
||||||
|
|
||||||
|
${if gui.enable then ''
|
||||||
git_branch_PS1="\[\033[01;31m\]$git_branch :\[\033[00m\]"
|
git_branch_PS1="\[\033[01;31m\]$git_branch :\[\033[00m\]"
|
||||||
|
'' else ''
|
||||||
|
git_branch_PS1="\[\033[01;31m\]$git_branch ~:\[\033[00m\]"
|
||||||
|
''}
|
||||||
|
|
||||||
set_git_dir
|
set_git_dir
|
||||||
check_venv
|
check_venv
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.modules.user.bash;
|
cfg = config.modules.user.bash;
|
||||||
|
gui = config.modules.user.gui.sway;
|
||||||
|
|
||||||
in
|
in
|
||||||
{ options.modules.user.bash = { enable = mkEnableOption "user.bash"; };
|
{ options.modules.user.bash = { enable = mkEnableOption "user.bash"; };
|
||||||
|
|
@ -18,9 +19,11 @@ in
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
ripgrep.enable = true;
|
ripgrep.enable = true;
|
||||||
lsd = {
|
eza = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableAliases = true;
|
enableAliases = true;
|
||||||
|
} // optionalAttrs gui.enable {
|
||||||
|
icons = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue