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>
This commit is contained in:
ediblerope 2026-04-08 13:22:21 +01:00
parent a14cc55921
commit 09d00909cb
5 changed files with 94 additions and 108 deletions

View file

@ -1,4 +1,4 @@
{ config, pkgs, ... }:
{ config, pkgs, lib, ... }:
{
# Install fastfetch
environment.systemPackages = with pkgs; [
@ -12,34 +12,8 @@
nerd-fonts.meslo-lg
];
# 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
environment.etc."fastfetch/custom-info.sh" = {
text = ''
#!/bin/sh
# Color codes
CYAN="\033[0;36m"
BLUE="\033[0;34m"
GREEN="\033[0;32m"
PURPLE="\033[0;35m"
GRAY="\033[0;90m"
RESET="\033[0m"
echo -e "''${CYAN}$(hostname)''${RESET}''${BLUE}@NixOS_Unstable''${RESET} ''${GRAY}-''${RESET} ''${GREEN}$(uname) $(uname -r)''${RESET} ''${GRAY}-''${RESET} ''${PURPLE}$(gnome-shell --version 2>/dev/null | awk '{print $1, $3}')''${RESET}"
'';
mode = "0755";
};
# Create the fastfetch config file
# Simple fastfetch config — shown on terminal start
# Run `fastfetch` manually for full system info
environment.etc."fastfetch/config.jsonc".text = ''
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
@ -58,87 +32,83 @@
},
"modules": [
{
"type": "command",
"text": "/etc/fastfetch/custom-info.sh"
"type": "title",
"format": "{user-name}@{host-name}"
},
{
"type": "colors",
"symbol": "circle"
}
"separator",
"os",
"kernel",
"shell",
"terminal",
"uptime",
"memory"
]
}
'';
# Set up bash with fastfetch and a nice prompt
programs.bash.promptInit = ''
# Simple colored prompt without backgrounds
# Foreground colors
FG_ORANGE="\001$(echo -e '\033[38;5;208m')\002"
FG_GREEN="\001$(echo -e '\033[38;5;35m')\002"
FG_CYAN="\001$(echo -e '\033[38;5;37m')\002"
FG_BLUE="\001$(echo -e '\033[38;5;33m')\002"
FG_PURPLE="\001$(echo -e '\033[38;5;98m')\002"
FG_YELLOW="\001$(echo -e '\033[38;5;220m')\002"
FG_GRAY="\001$(echo -e '\033[38;5;245m')\002"
RESET="\001$(echo -e '\033[0m')\002"
# Function to build path with colored segments
build_path_prompt() {
local output=""
# Check if in nix-shell and show indicator
if [ -n "''${IN_NIX_SHELL}" ]; then
output+="''${FG_YELLOW}[nix-shell]''${RESET} "
fi
# Username in orange
output+="''${FG_ORANGE}\u''${RESET} "
# Path segments
local path="''${PWD/#$HOME/\~}"
# If we're in home directory, just show ~
if [ "$path" = "~" ]; then
output+="''${FG_GREEN}~''${RESET}"
echo -n "$output"
return
fi
local IFS='/'
local parts=($path)
local colors=("''${FG_GREEN}" "''${FG_CYAN}" "''${FG_BLUE}")
local i=0
for part in "''${parts[@]}"; do
if [ -n "$part" ]; then
local color_idx=$((i % 3))
if [ $i -gt 0 ]; then
output+="''${FG_GRAY}/''${RESET}"
fi
output+="''${colors[$color_idx]}$part''${RESET}"
((i++))
fi
done
echo -n "$output"
}
# Function to get git branch
parse_git_branch() {
local branch=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
if [ -n "$branch" ]; then
echo -n " ''${FG_PURPLE} $branch''${RESET}"
fi
}
# Set prompt command to rebuild on each prompt
PROMPT_COMMAND='PS1="$(build_path_prompt)$(parse_git_branch) ''${FG_PURPLE}''${RESET} "'
'';
programs.bash.interactiveShellInit = ''
# Fish prompt and terminal startup
programs.fish.interactiveShellInit = ''
# Run fastfetch on terminal start
if [[ $- == *i* ]]; then
${pkgs.fastfetch}/bin/fastfetch --config /etc/fastfetch/config.jsonc
fi
fastfetch --config /etc/fastfetch/config.jsonc
# Custom prompt
function fish_prompt
set -l last_status $status
# Nix-shell indicator
if set -q IN_NIX_SHELL
set_color yellow
printf '[nix-shell] '
set_color normal
end
# Line 1: username ~ hostname
set_color green
printf ' '
set_color yellow
printf '%s' $USER
set_color normal
printf ' '
# Path with colored segments
set -l gitdir (command git rev-parse --show-toplevel 2>/dev/null)
set -l realhome (string escape --style=regex -- $HOME)
set -l path (string replace -r "^$realhome" '~' $PWD)
set -l parts (string split '/' $path)
set -l colors green cyan blue
for i in (seq (count $parts))
set -l part $parts[$i]
if test -n "$part"
if test $i -gt 1
set_color brblack
printf '/'
end
set -l cidx (math '(' $i - 1 ')' '%' 3 + 1)
set_color $colors[$cidx]
printf '%s' $part
end
end
# Hostname
set_color brblack
printf ' '
set_color magenta
printf '%s' (hostname)
set_color normal
printf '\n'
# Line 2:
if test $last_status -ne 0
set_color red
else
set_color magenta
end
printf ' '
set_color normal
end
# Disable the default right prompt
function fish_right_prompt; end
'';
}

View file

@ -69,7 +69,11 @@
networking.networkmanager.enable = true;
networking.nameservers = [ "1.1.1.1" "9.9.9.9" ];
# Shell aliases
# Fish shell
programs.fish.enable = true;
users.defaultUserShell = pkgs.fish;
# Shell aliases (work in both bash and fish)
environment.shellAliases = {
update = "sudo nixos-rebuild switch --flake github:ediblerope/nixos-config";
clean = "sudo nix-collect-garbage -d";

View file

@ -14,6 +14,17 @@
{ allowUnfree = true; }
'';
# Ghostty config
home.file.".config/ghostty/config".text = ''
font-family = FiraCode Nerd Font
font-size = 11
theme = dark:catppuccin-mocha,light:catppuccin-latte
window-padding-x = 10
window-padding-y = 10
confirm-close-surface = false
gtk-titlebar = false
'';
# Import gnome home manager config
imports = [ ./gnome-hm.nix ];
}

View file

@ -57,7 +57,7 @@
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = {
name = "Terminal";
command = "kgx";
command = "ghostty";
binding = "<Super>t";
};

View file

@ -8,8 +8,9 @@
services.displayManager.gdm.wayland = true;
boot.plymouth.enable = false;
# Add extensions and packages
# Add extensions, packages, and terminal
environment.systemPackages = with pkgs; [
ghostty
gnomeExtensions.blur-my-shell
gnomeExtensions.just-perfection
gnomeExtensions.appindicator