Create prompt module
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
in {
|
||||
nixosModules = {
|
||||
common = import ./modules/common.nix;
|
||||
prompt = import ./modules/prompt.nix;
|
||||
server = import ./modules/server.nix;
|
||||
};
|
||||
|
||||
|
@@ -2,6 +2,7 @@
|
||||
{
|
||||
imports = [
|
||||
self.nixosModules.common
|
||||
self.nixosModules.prompt
|
||||
./backup.nix
|
||||
];
|
||||
|
||||
@@ -80,19 +81,6 @@
|
||||
obsidian
|
||||
];
|
||||
|
||||
programs.bash = {
|
||||
promptInit = ''
|
||||
PS1="\[\e]0;\u@\h: \w\a\]" # window title
|
||||
PS1+="\n"
|
||||
PS1+="\$(printf \"%*s\" \$((\$COLUMNS + 9)) \"\[\e[1;33m\]\$(git branch --show-current 2>/dev/null)\")" # git branch
|
||||
PS1+="\[\e[1G\]" # move cursor to beginning of line
|
||||
PS1+="💜" # prompt symbol
|
||||
PS1+="\[\033[1;$((UID ? 32 : 31))m\]" # prompt color
|
||||
PS1+="[\u@\h:\w]\\$"
|
||||
PS1+="\[\033[0m\] " # reset color
|
||||
'';
|
||||
};
|
||||
|
||||
programs.steam = {
|
||||
enable = true;
|
||||
remotePlay.openFirewall = true;
|
||||
@@ -120,6 +108,8 @@
|
||||
enable = true;
|
||||
};
|
||||
|
||||
promptEmoji = "💜";
|
||||
|
||||
time.timeZone = "America/Los_Angeles";
|
||||
|
||||
system.stateVersion = "24.05";
|
||||
|
10
modules/prompt.nix
Normal file
10
modules/prompt.nix
Normal file
@@ -0,0 +1,10 @@
|
||||
{ options, lib, config, ... }:
|
||||
{
|
||||
options.promptEmoji = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
};
|
||||
|
||||
config.programs.bash.promptInit = ''
|
||||
PS1="\[\e]0;\u@\h: \w\a\]\n${config.promptEmoji} \[\033[1;$((UID ? 32 : 31))m\]\w \\$\[\033[0m\] "
|
||||
'';
|
||||
}
|
Reference in New Issue
Block a user