nixos/apps/fastfetch.nix

160 lines
3.7 KiB
Nix
Raw Normal View History

2025-12-03 19:53:58 +00:00
{ config, pkgs, ... }:
{
# Install fastfetch
environment.systemPackages = with pkgs; [
fastfetch
];
2025-12-03 20:22:36 +00:00
# Create the fastfetch config file with unicode icons
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",
"logo": {
"source": "auto",
"padding": {
"top": 1,
"left": 2
}
},
"display": {
2025-12-03 20:22:36 +00:00
"separator": " ",
2025-12-03 19:53:58 +00:00
"color": {
"keys": "blue",
"title": "cyan"
}
},
"modules": [
{
"type": "title",
"format": "{user-name-colored}@{host-name-colored}"
},
{
"type": "separator",
"string": ""
},
{
"type": "os",
2025-12-03 20:22:36 +00:00
"key": " ",
2025-12-03 19:53:58 +00:00
"keyColor": "blue"
},
{
"type": "host",
2025-12-03 20:22:36 +00:00
"key": "󰌢 ",
2025-12-03 19:53:58 +00:00
"keyColor": "blue"
},
{
"type": "kernel",
2025-12-03 20:22:36 +00:00
"key": " ",
2025-12-03 19:53:58 +00:00
"keyColor": "blue"
},
{
"type": "uptime",
2025-12-03 20:22:36 +00:00
"key": "󰔟 ",
2025-12-03 19:53:58 +00:00
"keyColor": "blue"
},
{
"type": "packages",
2025-12-03 20:22:36 +00:00
"key": "󰏖 ",
2025-12-03 19:53:58 +00:00
"keyColor": "blue"
},
{
"type": "shell",
2025-12-03 20:22:36 +00:00
"key": " ",
2025-12-03 19:53:58 +00:00
"keyColor": "blue"
},
{
"type": "terminal",
2025-12-03 20:22:36 +00:00
"key": " ",
2025-12-03 19:53:58 +00:00
"keyColor": "blue"
},
{
"type": "de",
2025-12-03 20:22:36 +00:00
"key": " ",
2025-12-03 19:53:58 +00:00
"keyColor": "blue"
},
{
"type": "wm",
2025-12-03 20:22:36 +00:00
"key": " ",
2025-12-03 19:53:58 +00:00
"keyColor": "blue"
},
{
"type": "wmtheme",
2025-12-03 20:22:36 +00:00
"key": "󰉼 ",
2025-12-03 19:53:58 +00:00
"keyColor": "blue"
},
{
"type": "icons",
2025-12-03 20:22:36 +00:00
"key": "󰀻 ",
2025-12-03 19:53:58 +00:00
"keyColor": "blue"
},
{
"type": "cpu",
2025-12-03 20:22:36 +00:00
"key": "󰻠 ",
2025-12-03 19:53:58 +00:00
"keyColor": "green"
},
{
"type": "gpu",
2025-12-03 20:22:36 +00:00
"key": "󰍛 ",
2025-12-03 19:53:58 +00:00
"keyColor": "green"
},
{
"type": "memory",
2025-12-03 20:22:36 +00:00
"key": "󰑭 ",
2025-12-03 19:53:58 +00:00
"keyColor": "yellow"
},
{
"type": "disk",
2025-12-03 20:22:36 +00:00
"key": "󰋊 ",
2025-12-03 19:53:58 +00:00
"keyColor": "yellow"
},
{
"type": "separator",
"string": ""
},
{
"type": "colors",
"paddingLeft": 2,
"symbol": "circle"
}
]
}
'';
2025-12-03 20:22:36 +00:00
# Set up bash with fastfetch and a nice prompt
2025-12-03 19:53:58 +00:00
programs.bash.interactiveShellInit = ''
# Run fastfetch on terminal start (but not in non-interactive shells)
if [[ $- == *i* ]]; then
${pkgs.fastfetch}/bin/fastfetch --config /etc/fastfetch/config.jsonc
fi
2025-12-03 20:22:36 +00:00
# Color definitions
RESET="\[\033[0m\]"
BOLD="\[\033[1m\]"
# Colors
CYAN="\[\033[0;36m\]"
BLUE="\[\033[0;34m\]"
PURPLE="\[\033[0;35m\]"
GREEN="\[\033[0;32m\]"
YELLOW="\[\033[0;33m\]"
RED="\[\033[0;31m\]"
# Bold colors
BCYAN="\[\033[1;36m\]"
BBLUE="\[\033[1;34m\]"
BPURPLE="\[\033[1;35m\]"
BGREEN="\[\033[1;32m\]"
# Function to get git branch
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# Stylish prompt with icons
# Shows: ╭─ user@host ~/current/directory (git-branch)
# ╰─❯
PS1="${RESET}${BCYAN}${RESET} ${BPURPLE}\u${RESET}${CYAN}@${RESET}${BBLUE}\h${RESET} ${BGREEN} \w${RESET}${YELLOW}\$(parse_git_branch)${RESET}\n${BCYAN}${BPURPLE}${RESET} "
2025-12-03 19:53:58 +00:00
'';
}