2025-12-03 19:53:58 +00:00
|
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
{
|
2025-12-21 20:42:08 +00:00
|
|
|
|
# Install fastfetch
|
2025-12-03 19:53:58 +00:00
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
|
|
fastfetch
|
|
|
|
|
|
];
|
2025-12-21 20:42:08 +00:00
|
|
|
|
|
2025-12-03 20:29:05 +00:00
|
|
|
|
# Install Nerd Fonts for icon support
|
|
|
|
|
|
fonts.packages = with pkgs; [
|
2025-12-03 20:29:57 +00:00
|
|
|
|
nerd-fonts.fira-code
|
|
|
|
|
|
nerd-fonts.jetbrains-mono
|
|
|
|
|
|
nerd-fonts.meslo-lg
|
2025-12-03 20:29:05 +00:00
|
|
|
|
];
|
2025-12-21 20:42:08 +00:00
|
|
|
|
|
|
|
|
|
|
# Configure GNOME Console to use Nerd Font
|
|
|
|
|
|
programs.dconf.profiles.user.databases = [{
|
|
|
|
|
|
settings = {
|
|
|
|
|
|
"org/gnome/Console" = {
|
|
|
|
|
|
use-system-font = false;
|
|
|
|
|
|
custom-font = "FiraCode Nerd Font 11";
|
|
|
|
|
|
};
|
|
|
|
|
|
};
|
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
|
|
# Create a script for the fastfetch command
|
2025-12-21 20:39:28 +00:00
|
|
|
|
environment.etc."fastfetch/custom-info.sh" = {
|
|
|
|
|
|
text = ''
|
|
|
|
|
|
#!/bin/sh
|
2025-12-21 20:42:08 +00:00
|
|
|
|
echo "$(hostname)@NixOS_Unstable - $(uname) $(uname -r) - $(gnome-shell --version 2>/dev/null | awk '{print $1, $3}')"
|
2025-12-21 20:39:28 +00:00
|
|
|
|
'';
|
|
|
|
|
|
mode = "0755";
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-12-21 20:42:08 +00:00
|
|
|
|
# Create the fastfetch config file
|
2025-12-03 19:53:58 +00:00
|
|
|
|
environment.etc."fastfetch/config.jsonc".text = ''
|
|
|
|
|
|
{
|
|
|
|
|
|
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
2025-12-21 12:16:53 +00:00
|
|
|
|
"logo": {
|
|
|
|
|
|
"source": "none"
|
|
|
|
|
|
},
|
2025-12-03 19:53:58 +00:00
|
|
|
|
"display": {
|
2025-12-03 20:22:36 +00:00
|
|
|
|
"separator": " ",
|
2025-12-03 19:53:58 +00:00
|
|
|
|
"color": {
|
|
|
|
|
|
"keys": "blue",
|
|
|
|
|
|
"title": "cyan"
|
2025-12-03 20:58:54 +00:00
|
|
|
|
},
|
|
|
|
|
|
"key": {
|
|
|
|
|
|
"type": "icon"
|
2025-12-03 19:53:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
"modules": [
|
|
|
|
|
|
{
|
2025-12-21 14:05:34 +00:00
|
|
|
|
"type": "command",
|
2025-12-21 20:39:28 +00:00
|
|
|
|
"text": "/etc/fastfetch/custom-info.sh"
|
2025-12-03 19:53:58 +00:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"type": "colors",
|
|
|
|
|
|
"symbol": "circle"
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
'';
|
2025-12-21 20:42:08 +00:00
|
|
|
|
|
2025-12-03 20:22:36 +00:00
|
|
|
|
# Set up bash with fastfetch and a nice prompt
|
2025-12-03 20:29:05 +00:00
|
|
|
|
programs.bash.promptInit = ''
|
2025-12-21 19:51:14 +00:00
|
|
|
|
# Simple colored prompt without backgrounds
|
|
|
|
|
|
# Foreground colors
|
|
|
|
|
|
FG_ORANGE="\001$(echo -e '\033[38;5;208m')\002"
|
2025-12-21 17:42:37 +00:00
|
|
|
|
FG_GREEN="\001$(echo -e '\033[38;5;35m')\002"
|
|
|
|
|
|
FG_CYAN="\001$(echo -e '\033[38;5;37m')\002"
|
2025-12-21 19:51:14 +00:00
|
|
|
|
FG_BLUE="\001$(echo -e '\033[38;5;33m')\002"
|
|
|
|
|
|
FG_PURPLE="\001$(echo -e '\033[38;5;98m')\002"
|
|
|
|
|
|
FG_GRAY="\001$(echo -e '\033[38;5;245m')\002"
|
2025-12-21 17:42:37 +00:00
|
|
|
|
RESET="\001$(echo -e '\033[0m')\002"
|
2025-12-21 14:11:48 +00:00
|
|
|
|
|
2025-12-21 14:13:58 +00:00
|
|
|
|
# Function to build path with colored segments
|
|
|
|
|
|
build_path_prompt() {
|
2025-12-21 19:37:26 +00:00
|
|
|
|
local output=""
|
|
|
|
|
|
|
2025-12-21 19:51:14 +00:00
|
|
|
|
# Username in orange
|
|
|
|
|
|
output+="''${FG_ORANGE}\u''${RESET} "
|
2025-12-21 19:37:26 +00:00
|
|
|
|
|
|
|
|
|
|
# Path segments
|
2025-12-21 19:52:24 +00:00
|
|
|
|
local path="''${PWD/#$HOME/\~}"
|
|
|
|
|
|
|
|
|
|
|
|
# If we're in home directory, just show ~
|
|
|
|
|
|
if [ "$path" = "~" ]; then
|
|
|
|
|
|
output+="''${FG_GREEN}~''${RESET}"
|
|
|
|
|
|
echo -n "$output"
|
|
|
|
|
|
return
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
2025-12-21 14:13:58 +00:00
|
|
|
|
local IFS='/'
|
|
|
|
|
|
local parts=($path)
|
2025-12-21 19:51:14 +00:00
|
|
|
|
local colors=("''${FG_GREEN}" "''${FG_CYAN}" "''${FG_BLUE}")
|
2025-12-21 14:13:58 +00:00
|
|
|
|
local i=0
|
|
|
|
|
|
|
|
|
|
|
|
for part in "''${parts[@]}"; do
|
|
|
|
|
|
if [ -n "$part" ]; then
|
2025-12-21 19:51:14 +00:00
|
|
|
|
local color_idx=$((i % 3))
|
|
|
|
|
|
if [ $i -gt 0 ]; then
|
|
|
|
|
|
output+="''${FG_GRAY}/''${RESET}"
|
2025-12-21 14:13:58 +00:00
|
|
|
|
fi
|
2025-12-21 19:51:14 +00:00
|
|
|
|
output+="''${colors[$color_idx]}$part''${RESET}"
|
2025-12-21 14:13:58 +00:00
|
|
|
|
((i++))
|
|
|
|
|
|
fi
|
|
|
|
|
|
done
|
|
|
|
|
|
|
2025-12-21 19:37:26 +00:00
|
|
|
|
echo -n "$output"
|
2025-12-21 14:13:58 +00:00
|
|
|
|
}
|
2025-12-03 20:22:36 +00:00
|
|
|
|
|
|
|
|
|
|
# Function to get git branch
|
|
|
|
|
|
parse_git_branch() {
|
2025-12-21 14:11:48 +00:00
|
|
|
|
local branch=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
|
|
|
|
|
|
if [ -n "$branch" ]; then
|
2025-12-21 19:51:14 +00:00
|
|
|
|
echo -n " ''${FG_PURPLE} $branch''${RESET}"
|
2025-12-21 14:11:48 +00:00
|
|
|
|
fi
|
2025-12-03 20:22:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-21 14:13:58 +00:00
|
|
|
|
# Set prompt command to rebuild on each prompt
|
2025-12-21 19:51:14 +00:00
|
|
|
|
PROMPT_COMMAND='PS1="$(build_path_prompt)$(parse_git_branch) ''${FG_PURPLE}❯''${RESET} "'
|
2025-12-03 19:53:58 +00:00
|
|
|
|
'';
|
2025-12-21 20:42:08 +00:00
|
|
|
|
|
2025-12-03 20:29:05 +00:00
|
|
|
|
programs.bash.interactiveShellInit = ''
|
2025-12-03 21:29:18 +00:00
|
|
|
|
# Run fastfetch on terminal start
|
2025-12-03 20:29:05 +00:00
|
|
|
|
if [[ $- == *i* ]]; then
|
2025-12-03 21:29:18 +00:00
|
|
|
|
${pkgs.fastfetch}/bin/fastfetch --config /etc/fastfetch/config.jsonc
|
2025-12-03 20:29:05 +00:00
|
|
|
|
fi
|
|
|
|
|
|
'';
|
2025-12-03 19:53:58 +00:00
|
|
|
|
}
|