nixos/apps/fastfetch.nix

161 lines
3.9 KiB
Nix
Raw Normal View History

2025-12-03 19:53:58 +00:00
{ config, pkgs, ... }:
{
2025-12-20 22:43:22 +00:00
# Install fastfetch, ghostty, and nerd fonts
2025-12-03 19:53:58 +00:00
environment.systemPackages = with pkgs; [
fastfetch
2025-12-21 11:57:05 +00:00
ghostty
2025-12-03 19:53:58 +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-20 22:37:20 +00:00
# Download your custom image from GitHub
environment.etc."fastfetch/logo.png".source = pkgs.fetchurl {
2025-12-21 11:45:15 +00:00
url = "https://raw.githubusercontent.com/ediblerope/nixos-config/main/walls/owventures-2.png";
2025-12-21 11:51:46 +00:00
sha256 = "sha256-kLAEahmpqZklN9FAMMI/ojPWB/rC2yb2Ip8gk6RIStk=";
2025-12-03 21:23:04 +00:00
};
2025-12-03 21:22:01 +00:00
2025-12-20 22:37:20 +00:00
# Create the fastfetch config file with custom image
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": {
2025-12-20 22:37:20 +00:00
"source": "/etc/fastfetch/logo.png",
2025-12-20 22:43:22 +00:00
"type": "kitty-direct",
2025-12-21 12:00:32 +00:00
"width": 20,
"height": 13,
2025-12-03 19:53:58 +00:00
"padding": {
"top": 1,
2025-12-20 22:37:20 +00:00
"left": 2,
"right": 4
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": [
{
"type": "title",
"format": "{user-name-colored}@{host-name-colored}"
},
{
"type": "separator",
"string": ""
},
{
"type": "os",
"keyColor": "blue"
},
{
"type": "host",
"keyColor": "blue"
},
{
"type": "kernel",
"keyColor": "blue"
},
{
"type": "uptime",
"keyColor": "blue"
},
{
"type": "packages",
"keyColor": "blue"
},
{
"type": "shell",
"keyColor": "blue"
},
{
"type": "terminal",
"keyColor": "blue"
},
{
"type": "de",
"keyColor": "blue"
},
{
"type": "wm",
"keyColor": "blue"
},
{
"type": "wmtheme",
"keyColor": "blue"
},
{
"type": "icons",
"keyColor": "blue"
},
{
"type": "cpu",
"keyColor": "green"
},
{
"type": "gpu",
"keyColor": "green"
},
{
"type": "memory",
"keyColor": "yellow"
},
{
"type": "disk",
"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 20:29:05 +00:00
programs.bash.promptInit = ''
# Stylish prompt with icons
2025-12-03 20:22:36 +00:00
# Color definitions
RESET="\[\033[0m\]"
CYAN="\[\033[0;36m\]"
BLUE="\[\033[0;34m\]"
PURPLE="\[\033[0;35m\]"
GREEN="\[\033[0;32m\]"
YELLOW="\[\033[0;33m\]"
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)/'
}
2025-12-03 20:29:05 +00:00
# Set the prompt
2025-12-03 20:24:57 +00:00
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
'';
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
}