Switch to fish shell, ghostty terminal, and simplified prompt
- Replace bash with fish as default shell (all hosts)
- Replace kgx with ghostty (desktop hosts), update Super+T keybinding
- Custom two-line fish prompt: NixOS icon, username, path, hostname, ❯
- Nix-shell awareness, red ❯ on error
- Simplify fastfetch: user@host, OS, kernel, shell, terminal, uptime, memory
- Ghostty config: FiraCode Nerd Font, catppuccin-mocha, no titlebar
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 13:22:21 +01:00
|
|
|
|
{ config, pkgs, lib, ... }:
|
2026-07-28 22:28:56 +01:00
|
|
|
|
let
|
|
|
|
|
|
c = config.lib.stylix.colors;
|
2026-07-28 22:39:09 +01:00
|
|
|
|
# One dot per base16 slot. The literal \u001b in the format string stays a
|
|
|
|
|
|
# JSON escape here — fastfetch's JSONC parser turns it into a real ESC byte.
|
|
|
|
|
|
# Foreground glyph, not a background-coloured space: a coloured space is
|
2026-07-28 22:33:07 +01:00
|
|
|
|
# invisible anywhere the colour is stripped (copy/paste, piped output).
|
2026-07-28 22:39:09 +01:00
|
|
|
|
swatch = n: "\\u001b[38;2;${c."${n}-rgb-r"};${c."${n}-rgb-g"};${c."${n}-rgb-b"}m● ";
|
2026-07-28 22:28:56 +01:00
|
|
|
|
paletteRow = names: lib.concatMapStrings swatch names + "\\u001b[0m";
|
2026-07-28 22:39:09 +01:00
|
|
|
|
isDesktop = lib.elem config.networking.hostName [ "FredOS-Gaming" "FredOS-Macbook" ];
|
2026-07-28 22:28:56 +01:00
|
|
|
|
in
|
2025-12-03 19:53:58 +00:00
|
|
|
|
{
|
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
|
2026-04-09 16:10:30 +00:00
|
|
|
|
nerd-fonts.fira-mono
|
2025-12-03 20:29:57 +00:00
|
|
|
|
nerd-fonts.jetbrains-mono
|
|
|
|
|
|
nerd-fonts.meslo-lg
|
2025-12-03 20:29:05 +00:00
|
|
|
|
];
|
2025-12-21 20:42:08 +00:00
|
|
|
|
|
2026-04-08 13:54:44 +01:00
|
|
|
|
# Simple fastfetch config — run `fastfetch` manually for system info
|
2026-04-08 13:56:31 +01:00
|
|
|
|
environment.etc."fastfetch/config.jsonc".text = ''
|
2025-12-03 19:53:58 +00:00
|
|
|
|
{
|
|
|
|
|
|
"$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": [
|
|
|
|
|
|
{
|
Switch to fish shell, ghostty terminal, and simplified prompt
- Replace bash with fish as default shell (all hosts)
- Replace kgx with ghostty (desktop hosts), update Super+T keybinding
- Custom two-line fish prompt: NixOS icon, username, path, hostname, ❯
- Nix-shell awareness, red ❯ on error
- Simplify fastfetch: user@host, OS, kernel, shell, terminal, uptime, memory
- Ghostty config: FiraCode Nerd Font, catppuccin-mocha, no titlebar
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 13:22:21 +01:00
|
|
|
|
"type": "title",
|
|
|
|
|
|
"format": "{user-name}@{host-name}"
|
2025-12-03 19:53:58 +00:00
|
|
|
|
},
|
Switch to fish shell, ghostty terminal, and simplified prompt
- Replace bash with fish as default shell (all hosts)
- Replace kgx with ghostty (desktop hosts), update Super+T keybinding
- Custom two-line fish prompt: NixOS icon, username, path, hostname, ❯
- Nix-shell awareness, red ❯ on error
- Simplify fastfetch: user@host, OS, kernel, shell, terminal, uptime, memory
- Ghostty config: FiraCode Nerd Font, catppuccin-mocha, no titlebar
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 13:22:21 +01:00
|
|
|
|
"separator",
|
|
|
|
|
|
"os",
|
|
|
|
|
|
"kernel",
|
2026-07-28 22:28:56 +01:00
|
|
|
|
"uptime",
|
|
|
|
|
|
"memory",
|
|
|
|
|
|
"break",
|
2026-07-28 22:39:09 +01:00
|
|
|
|
"wm",${lib.optionalString isDesktop ''
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
"type": "custom",
|
|
|
|
|
|
"key": "Shell",
|
|
|
|
|
|
"keyIcon": "",
|
|
|
|
|
|
"format": "Quickshell ${pkgs.quickshell.version} (bar, launcher, lock)"
|
|
|
|
|
|
},''}
|
Switch to fish shell, ghostty terminal, and simplified prompt
- Replace bash with fish as default shell (all hosts)
- Replace kgx with ghostty (desktop hosts), update Super+T keybinding
- Custom two-line fish prompt: NixOS icon, username, path, hostname, ❯
- Nix-shell awareness, red ❯ on error
- Simplify fastfetch: user@host, OS, kernel, shell, terminal, uptime, memory
- Ghostty config: FiraCode Nerd Font, catppuccin-mocha, no titlebar
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 13:22:21 +01:00
|
|
|
|
"shell",
|
|
|
|
|
|
"terminal",
|
2026-07-28 22:28:56 +01:00
|
|
|
|
"break",
|
|
|
|
|
|
{
|
|
|
|
|
|
"type": "custom",
|
2026-07-28 22:39:09 +01:00
|
|
|
|
"key": "Palette",
|
2026-07-28 22:33:07 +01:00
|
|
|
|
"keyIcon": "",
|
2026-07-28 22:39:09 +01:00
|
|
|
|
"format": "${paletteRow [ "base00" "base01" "base02" "base03" "base04" "base05" "base06" "base07" "base08" "base09" "base0A" "base0B" "base0C" "base0D" "base0E" "base0F" ]}"
|
2026-07-28 22:28:56 +01:00
|
|
|
|
}
|
2025-12-03 19:53:58 +00:00
|
|
|
|
]
|
|
|
|
|
|
}
|
2026-04-08 13:56:31 +01:00
|
|
|
|
'';
|
2026-04-08 13:54:44 +01:00
|
|
|
|
|
|
|
|
|
|
# Fish shell settings and custom powerline prompt
|
2026-04-08 13:56:31 +01:00
|
|
|
|
programs.fish.interactiveShellInit = ''
|
2026-04-08 13:42:57 +01:00
|
|
|
|
# Disable default greeting
|
|
|
|
|
|
set -g fish_greeting
|
2026-04-08 13:54:44 +01:00
|
|
|
|
|
|
|
|
|
|
# Custom powerline prompt
|
|
|
|
|
|
function fish_prompt
|
|
|
|
|
|
set -l last_status $status
|
|
|
|
|
|
|
|
|
|
|
|
# Nix-shell indicator
|
|
|
|
|
|
if set -q IN_NIX_SHELL
|
|
|
|
|
|
set_color -o yellow
|
|
|
|
|
|
printf "[nix-shell] "
|
|
|
|
|
|
set_color normal
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# --- Line 1: powerline segments ---
|
|
|
|
|
|
# Left round cap + NixOS icon
|
2026-04-08 13:58:42 +01:00
|
|
|
|
set_color 394b70
|
2026-04-08 13:54:44 +01:00
|
|
|
|
printf ""
|
2026-04-08 13:58:42 +01:00
|
|
|
|
set_color 7dcfff -b 394b70
|
2026-04-08 14:07:19 +01:00
|
|
|
|
printf " "
|
2026-04-08 13:54:44 +01:00
|
|
|
|
|
|
|
|
|
|
# Arrow transition: nix -> hostname
|
2026-04-08 13:58:42 +01:00
|
|
|
|
set_color 394b70 -b e0af68
|
2026-04-08 13:54:44 +01:00
|
|
|
|
printf ""
|
2026-04-09 16:03:45 +00:00
|
|
|
|
set_color 000000 -b e0af68
|
2026-04-08 13:54:44 +01:00
|
|
|
|
printf " %s " (hostname)
|
|
|
|
|
|
|
|
|
|
|
|
# Path segments - each folder gets its own color
|
|
|
|
|
|
set -l realhome (string escape --style=regex -- $HOME)
|
|
|
|
|
|
set -l rawpath (string replace -r "^$realhome" "~" $PWD)
|
|
|
|
|
|
set -l parts (string split "/" $rawpath)
|
2026-04-08 13:58:42 +01:00
|
|
|
|
set -l path_colors 41a6b5 9ece6a 7aa2f7
|
2026-04-08 13:54:44 +01:00
|
|
|
|
|
2026-04-08 13:58:42 +01:00
|
|
|
|
set -l prev_bg e0af68
|
2026-04-08 13:54:44 +01:00
|
|
|
|
set -l seg_count 0
|
|
|
|
|
|
|
|
|
|
|
|
for part in $parts
|
|
|
|
|
|
if test -n "$part"
|
|
|
|
|
|
set seg_count (math $seg_count + 1)
|
|
|
|
|
|
set -l cidx (math "(" $seg_count - 1 ")" "%" 3 + 1)
|
|
|
|
|
|
set -l seg_bg $path_colors[$cidx]
|
|
|
|
|
|
|
|
|
|
|
|
# Arrow from previous segment
|
|
|
|
|
|
set_color $prev_bg -b $seg_bg
|
|
|
|
|
|
printf ""
|
2026-04-08 13:58:42 +01:00
|
|
|
|
set_color 1a1b26 -b $seg_bg
|
2026-04-08 13:54:44 +01:00
|
|
|
|
printf " %s " $part
|
|
|
|
|
|
|
|
|
|
|
|
set prev_bg $seg_bg
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# Git branch (if in a repo)
|
|
|
|
|
|
set -l branch (command git branch --show-current 2>/dev/null)
|
|
|
|
|
|
if test -n "$branch"
|
2026-04-08 13:58:42 +01:00
|
|
|
|
set_color $prev_bg -b bb9af7
|
2026-04-08 13:54:44 +01:00
|
|
|
|
printf ""
|
2026-04-08 13:58:42 +01:00
|
|
|
|
set_color 1a1b26 -b bb9af7
|
2026-04-08 13:54:44 +01:00
|
|
|
|
printf " %s " $branch
|
2026-04-08 13:58:42 +01:00
|
|
|
|
set prev_bg bb9af7
|
2026-04-08 13:54:44 +01:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# Final arrow to terminal bg
|
|
|
|
|
|
set_color $prev_bg -b normal
|
|
|
|
|
|
printf ""
|
|
|
|
|
|
set_color normal
|
|
|
|
|
|
printf "\n"
|
|
|
|
|
|
|
|
|
|
|
|
# --- Line 2: prompt character ---
|
|
|
|
|
|
if test $last_status -ne 0
|
|
|
|
|
|
set_color red
|
|
|
|
|
|
else
|
|
|
|
|
|
set_color magenta
|
|
|
|
|
|
end
|
|
|
|
|
|
printf "❯ "
|
|
|
|
|
|
set_color normal
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function fish_right_prompt; end
|
2026-08-19 14:10:11 +01:00
|
|
|
|
|
|
|
|
|
|
# GPU load, averaged. A single read of gpu_busy_percent is worthless —
|
|
|
|
|
|
# it catches whatever transient the card was in at that instant. Settle
|
|
|
|
|
|
# first, then sample, and report the spread as well as the mean: a
|
|
|
|
|
|
# steady 30% and a 0-to-70% sawtooth are different problems.
|
|
|
|
|
|
function gpumean --description "Mean GPU busy % — 5s settle, then N seconds at 5Hz (default 10)"
|
|
|
|
|
|
set -l secs 10
|
|
|
|
|
|
test (count $argv) -gt 0; and set secs $argv[1]
|
|
|
|
|
|
# find, not a glob: an unmatched wildcard is an error in fish and would
|
2026-08-20 20:07:09 +01:00
|
|
|
|
# abort the function before the emptiness check below. -L is required —
|
|
|
|
|
|
# /sys/class/drm/cardN is a symlink, so a plain find never descends into
|
|
|
|
|
|
# it and silently reports no GPUs at all.
|
|
|
|
|
|
set -l cards (find -L /sys/class/drm -maxdepth 3 -name gpu_busy_percent 2>/dev/null | sort)
|
2026-08-19 14:10:11 +01:00
|
|
|
|
if test (count $cards) -eq 0
|
|
|
|
|
|
echo "no gpu_busy_percent found (amdgpu/i915 only — nvidia doesn't expose it)"
|
|
|
|
|
|
return 1
|
|
|
|
|
|
end
|
|
|
|
|
|
sleep 5
|
|
|
|
|
|
set -l sum; set -l lo; set -l hi
|
|
|
|
|
|
for c in $cards
|
|
|
|
|
|
set -a sum 0; set -a lo 100; set -a hi 0
|
|
|
|
|
|
end
|
|
|
|
|
|
set -l n (math "$secs * 5")
|
|
|
|
|
|
for i in (seq $n)
|
|
|
|
|
|
for j in (seq (count $cards))
|
|
|
|
|
|
set -l v (cat $cards[$j])
|
|
|
|
|
|
set sum[$j] (math "$sum[$j] + $v")
|
|
|
|
|
|
test $v -lt $lo[$j]; and set lo[$j] $v
|
|
|
|
|
|
test $v -gt $hi[$j]; and set hi[$j] $v
|
|
|
|
|
|
end
|
|
|
|
|
|
sleep 0.2
|
|
|
|
|
|
end
|
|
|
|
|
|
for j in (seq (count $cards))
|
|
|
|
|
|
set -l name (string replace -r '.*/(card[0-9]+)/.*' '$1' $cards[$j])
|
|
|
|
|
|
echo "$name mean="(math -s0 "$sum[$j] / $n")"% min=$lo[$j]% max=$hi[$j]% ($secs""s)"
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
2026-04-08 13:56:31 +01:00
|
|
|
|
'';
|
2025-12-03 19:53:58 +00:00
|
|
|
|
}
|