# modules/home/prompt.nix — the starship prompt and the fastfetch card, fresh
# (2026-10-08), Rosé Pine, one colour per section, nothing Omarchy.
#
# Prompt (two lines, the dotfiles' "filigree" frame kept, the per-letter
# gradients gone):
#
# ╭╌ ☧ daemonsec@nixos ┄ ~/NixDaemon ┄ main [+2 !1] ⌁⡇⡆· (right: 3s · 14:02)
# ╰╌ ❯
#
# glyph iris · user rose · host foam · directory gold · git love (status subtle,
# week heartbeat iris) · languages text · duration/jobs gold · clock rose ·
# prompt char foam (love after an error). pine is never ink (3.3:1 on base).
# $CROSS_GLYPH comes from the dotfiles' animations.zsh (☧ + the NixOS glyph).
#
# theme.zsh in the dotfiles runs `starship init zsh` and adds the transient
# prompt, so home-manager's own shell integration stays off here.
#
# fastfetch: the builtin NixOS logo in iris/foam, keys in rotating Rosé Pine
# colours, the modules that matter on this laptop. The login splash
# (animations.zsh) runs plain `fastfetch` when CROSS_FETCH=plain, which
# .dotfiles/.zshrc now sets, so this config draws the whole card.
{ ... }:
let theme = import ../_palette.nix; in
{
flake.homeModules.prompt =
{ lib, ... }:
let
# Rosé Pine (main)
rp = theme.palette;
# the same colours as SGR parameters for fastfetch
sgr = theme.sgr;
lang = symbol: colour: {
inherit symbol;
format = " [$symbol($version)](fg:${colour})";
};
in
{
programs.starship = {
enable = true;
enableZshIntegration = false; # theme.zsh does it (with the transient prompt)
enableBashIntegration = false;
settings = {
"$schema" = "https://starship.rs/config-schema.json";
add_newline = true;
palette = theme.name;
palettes.${theme.name} = rp;
format = lib.concatStrings [
"[╭╌](fg:muted) "
"\${env_var.CROSS_GLYPH}"
# The current pentest target, when one is set. starship renders
# nothing that is not named here, so defining env_var.TARGET in
# modules/home/htb-shell.nix is not enough on its own. It collapses
# to nothing when $TARGET is unset.
"\${env_var.TARGET}"
"$username"
"$hostname"
"$shlvl"
"$sudo"
"\${custom.root}"
"$directory"
"$git_branch"
"$git_status"
"\${custom.gitweek}"
"$git_state"
"$python"
"$nodejs"
"$rust"
"$golang"
"$lua"
"$docker_context"
"$package"
"$line_break"
"[╰╌](fg:muted) "
"$status"
"$character"
];
right_format = lib.concatStrings [ "$cmd_duration" "$jobs" "$battery" "$time" ];
# identity
env_var.CROSS_GLYPH = {
variable = "CROSS_GLYPH";
default = "☧";
format = "[$env_value](bold fg:iris) ";
};
username = {
show_always = true;
format = "[$user](bold fg:rose)";
style_user = "bold fg:rose";
style_root = "bold fg:love";
};
hostname = {
ssh_only = false;
format = "[@](fg:muted)[$hostname](bold fg:foam)";
};
shlvl = {
disabled = false;
threshold = 2;
format = " [↕$shlvl](bold fg:gold)";
};
sudo = {
disabled = false;
format = " [](bold fg:love)";
};
custom.root = {
command = "echo ROOT";
when = "[ \"$(id -u)\" -eq 0 ]";
format = " [ $output](bold underline fg:love)";
};
# place
directory = {
format = " [┄](fg:muted) [ $path](bold fg:gold)[$read_only](fg:love)";
truncation_length = 4;
truncate_to_repo = true;
truncation_symbol = "…/";
read_only = " ";
};
# git
git_branch = {
symbol = " ";
format = " [┄](fg:muted) [$symbol$branch(:$remote_branch)](bold fg:love)";
};
git_status = {
format = "( [\\[$all_status$ahead_behind\\]](fg:subtle))";
ahead = "⇡\${count}";
behind = "⇣\${count}";
diverged = "⇕⇡\${ahead_count}⇣\${behind_count}";
conflicted = "=";
untracked = "?";
stashed = "≡";
modified = "!";
staged = "+";
renamed = "»";
deleted = "✘";
};
# the last 7 days of commits as a braille pulse (carried from the dotfiles)
custom.gitweek = {
command = ''git log --since=7.days --date=format:%Y%m%d --pretty=%cd 2>/dev/null | sort | uniq -c | awk 'BEGIN{split("· ⡀ ⡄ ⡆ ⡇",b," ")}{c[$2]=$1}END{for(i=6;i>=0;i--){d=strftime("%Y%m%d",systime()-i*86400);v=c[d]+0;idx=(v==0)?1:(v<3)?2:(v<6)?3:(v<10)?4:5;printf "%s",b[idx]}}' '';
when = "git rev-parse --is-inside-work-tree 2>/dev/null | grep -q true";
format = " [⌁$output](fg:iris)";
};
git_state = {
format = " [\\($state $progress_current/$progress_total\\)](bold fg:love)";
};
# toolchains: only when the directory uses them
python = (lang " " "text") // { format = " [$symbol$version( \\($virtualenv\\))](fg:text)"; };
nodejs = lang " " "text";
rust = lang " " "text";
golang = lang " " "text";
lua = lang " " "text";
docker_context = { symbol = " "; format = " [$symbol$context](fg:subtle)"; };
package = { symbol = " "; format = " [$symbol$version](fg:subtle)"; };
# right side
cmd_duration = { min_time = 2000; format = "[ $duration](fg:gold) "; };
jobs = { symbol = " "; format = "[$symbol$number](bold fg:gold) "; };
battery = {
full_symbol = " ";
charging_symbol = " ";
discharging_symbol = " ";
unknown_symbol = " ";
empty_symbol = " ";
format = "[$symbol$percentage]($style) ";
display = [
{ threshold = 20; style = "bold fg:love"; }
{ threshold = 50; style = "fg:gold"; }
];
};
time = {
disabled = false;
time_format = "%H:%M";
format = "[ $time](fg:rose)";
};
# second line
status = {
disabled = false;
symbol = "✗ ";
format = "[$symbol$status](fg:love) ";
};
character = {
success_symbol = "[❯](bold fg:foam)";
error_symbol = "[❯](bold fg:love)";
vimcmd_symbol = "[❮](bold fg:gold)";
vimcmd_replace_one_symbol = "[❮](bold fg:rose)";
vimcmd_replace_symbol = "[❮](bold fg:iris)";
vimcmd_visual_symbol = "[❮](bold fg:gold)";
};
line_break.disabled = false;
};
};
programs.fastfetch = {
enable = true;
settings = {
"$schema" = "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json";
logo = {
type = "builtin";
source = "nixos";
color = { "1" = sgr.iris; "2" = sgr.foam; };
padding = { top = 1; left = 2; right = 5; };
};
display = {
separator = " ";
color = { keys = sgr.foam; title = sgr.rose; };
};
modules = [
{ type = "title"; color = { user = sgr.rose; at = sgr.muted; host = sgr.foam; }; }
{ type = "separator"; string = "┄"; length = 34; outputColor = sgr.muted; }
{ type = "os"; key = " os"; keyColor = sgr.iris; }
{ type = "kernel"; key = " kernel"; keyColor = sgr.foam; }
{ type = "uptime"; key = " uptime"; keyColor = sgr.gold; }
{ type = "packages"; key = " packages"; keyColor = sgr.rose; }
{ type = "shell"; key = " shell"; keyColor = sgr.love; }
"break"
{ type = "wm"; key = " wm"; keyColor = sgr.iris; }
{ type = "display"; key = " display"; keyColor = sgr.foam; compactType = "original-with-refresh-rate"; }
{ type = "terminal"; key = " terminal"; keyColor = sgr.gold; }
{ type = "terminalfont"; key = " font"; keyColor = sgr.rose; }
"break"
{ type = "host"; key = " host"; keyColor = sgr.love; }
{ type = "cpu"; key = " cpu"; keyColor = sgr.iris; showPeCoreCount = true; }
{ type = "gpu"; key = " gpu"; keyColor = sgr.foam; detectionMethod = "pci"; format = "{name}"; }
{ type = "memory"; key = " memory"; keyColor = sgr.gold; }
{ type = "disk"; key = " disk"; keyColor = sgr.rose; folders = "/"; }
{ type = "battery"; key = " battery"; keyColor = sgr.love; }
"break"
{ type = "colors"; symbol = "circle"; paddingLeft = 2; }
];
};
};
}
;
}