refactor(config): externalize alacritty, starship, fastfetch, and interactive shell scripts

- Externalize Alacritty settings into `modules/user/config/alacritty/alacritty.toml` and load via `builtins.fromTOML`.
- Move Starship prompt configuration to `modules/user/config/starship.toml`.
- Migrate Fastfetch JSONC dashboard structure to `modules/user/config/fastfetch/config.jsonc` via `home.file`.
- Isolate Bash Readline word deletion keybindings and startup greeting logic into `modules/user/shell/interactive.sh`.

Rationale: Decouples large inline configuration blocks from Nix modules, improving readability and maintainability while keeping dotfiles clean and modular.
This commit is contained in:
kiskaadee committed 2026-09-08 13:30:58 -05:00
1 parent fb998d858f
commit ea6774eca1
8 files changed
+221 -128

No files matched your search

-6
View File
@@ -8,10 +8,4 @@
../../modules/user/apps.nix
../../modules/user/graphical.nix
];
# Niri WM declarative configuration files
home.file.".config/niri/config.kdl".source = ../../modules/user/config/niri/config.kdl;
home.file.".config/niri/custom.kdl".source = ../../modules/user/config/niri/custom.kdl;
}
+3 -48
View File
@@ -211,60 +211,15 @@
${builtins.readFile ./shell/quicklinks.sh} # Interactive fzf web launcher
${builtins.readFile ./shell/jump.sh} # Directory jumper & interactive fuzzy navigation
${builtins.readFile ./shell/todo.sh} # Todo.txt & tuxedo shortcuts and syntax highlighter
# --- Word Deletion & Readline Keybindings ---
if [[ -n "$BASH_VERSION" ]] && [[ "$-" == *i* ]]; then
# Ctrl+W: Delete entire word under cursor (backward-word + kill-word)
bind '"\C-w": "\eb\ed"' 2>/dev/null
# Ctrl+Delete: Forward word delete (matches Alacritty \e[3;5~)
bind '"\e[3;5~": kill-word' 2>/dev/null
# Ctrl+Backspace / Alt+Backspace: Backward word delete (start to cursor)
bind '"\e\x7f": backward-kill-word' 2>/dev/null
bind '"\e\b": backward-kill-word' 2>/dev/null
fi
# --- Visual Entry ---
# Display system information dashboard upon opening interactive shells
if [[ $- == *i* ]]; then
fastfetch --logo none
fi
${builtins.readFile ./shell/interactive.sh} # Readline word deletion keybindings & fastfetch entry
'';
};
};
# 📊 Custom Catnap-style Fastfetch
# A stylized, minimalist system information dashboard displayed on shell startup
programs.fastfetch = {
enable = true;
settings = {
display = {
separator = " ";
};
modules = [
{ key = "╭───────────╮"; type = "custom"; }
{ key = "│ user {#keys}│"; type = "title"; format = "{user-name}"; }
{ key = "│ 󰇅 hname {#keys}│"; type = "title"; format = "{host-name}"; }
{ type = "command"; key = "│ 󱦟 os age {#keys}│"; keyColor = "magenta"; text = "printf \"\\e[0m%s days\\e[0m\" \"$(( ($(date +%s) - $(stat -c %W /)) / 86400 ))\""; }
{ key = "│ 󰅐 uptime {#keys}│"; type = "uptime"; }
{ key = "│ {icon} distro {#keys}│"; type = "os"; }
{ key = "│ kernel {#keys}│"; type = "kernel"; }
{ key = "│ wm {#keys}│"; type = "wm"; }
{ key = "│ 󰇄 desktop {#keys}│"; type = "de"; }
{ key = "│ term {#keys}│"; type = "terminal"; }
{ key = "│ shell {#keys}│"; type = "shell"; }
{ key = "│ 󰍛 cpu {#keys}│"; type = "cpu"; showPeCoreCount = true; }
{ key = "│ 󰉉 root {#keys}│"; type = "disk"; folders = "/"; }
{ key = "│ 󰉉 home {#keys}│"; type = "disk"; folders = "/home"; }
{ key = "│ 󰉉 media {#keys}│"; type = "disk"; folders = "/media"; }
{ key = "│ memory {#keys}│"; type = "memory"; }
{ key = "├───────────┤"; type = "custom"; }
{ key = "│ colors {#keys}│"; type = "colors"; symbol = "circle"; }
{ key = "╰───────────╯"; type = "custom"; }
];
};
};
programs.fastfetch.enable = true;
home.file.".config/fastfetch/config.jsonc".source = ./config/fastfetch/config.jsonc;
# Standalone CLI utilities & system dependencies
home.packages = with pkgs; [
@@ -0,0 +1,96 @@
[general]
import = [
"~/.config/alacritty/dank-theme.toml"
]
[font]
size = 11.0
[font.normal]
family = "FiraCode Nerd Font"
style = "Regular"
[font.bold]
family = "FiraCode Nerd Font"
style = "Bold"
[font.italic]
family = "FiraCode Nerd Font"
style = "Italic"
[font.bold_italic]
family = "FiraCode Nerd Font"
style = "Bold Italic"
[window]
decorations = "None"
opacity = 1.0
[window.padding]
x = 12
y = 12
[scrolling]
history = 3023
[cursor]
blink_interval = 500
unfocused_hollow = true
[cursor.style]
shape = "Block"
blinking = "On"
[mouse]
hide_when_typing = true
[selection]
save_to_clipboard = false
[bell]
duration = 0
[[keyboard.bindings]]
key = "C"
mods = "Control|Shift"
action = "Copy"
[[keyboard.bindings]]
key = "V"
mods = "Control|Shift"
action = "Paste"
[[keyboard.bindings]]
key = "N"
mods = "Control|Shift"
action = "SpawnNewInstance"
[[keyboard.bindings]]
key = "Equals"
mods = "Control|Shift"
action = "IncreaseFontSize"
[[keyboard.bindings]]
key = "Minus"
mods = "Control"
action = "DecreaseFontSize"
[[keyboard.bindings]]
key = "Key0"
mods = "Control"
action = "ResetFontSize"
[[keyboard.bindings]]
key = "Enter"
mods = "Shift"
chars = "\n"
[[keyboard.bindings]]
key = "Delete"
mods = "Control"
chars = "\u001b[3;5~"
[[keyboard.bindings]]
key = "Back"
mods = "Control"
chars = "\u001b\u007f"
@@ -0,0 +1,93 @@
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"display": {
"separator": " "
},
"modules": [
{
"type": "custom",
"key": "╭───────────╮"
},
{
"type": "title",
"key": "│  user {#keys}│",
"format": "{user-name}"
},
{
"type": "title",
"key": "│ 󰇅 hname {#keys}│",
"format": "{host-name}"
},
{
"type": "command",
"key": "│ 󱦟 os age {#keys}│",
"keyColor": "magenta",
"text": "printf \"\\e[0m%s days\\e[0m\" \"$(( ($(date +%s) - $(stat -c %W /)) / 86400 ))\""
},
{
"type": "uptime",
"key": "│ 󰅐 uptime {#keys}│"
},
{
"type": "os",
"key": "│ {icon} distro {#keys}│"
},
{
"type": "kernel",
"key": "│  kernel {#keys}│"
},
{
"type": "wm",
"key": "│  wm {#keys}│"
},
{
"type": "de",
"key": "│ 󰇄 desktop {#keys}│"
},
{
"type": "terminal",
"key": "│  term {#keys}│"
},
{
"type": "shell",
"key": "│  shell {#keys}│"
},
{
"type": "cpu",
"key": "│ 󰍛 cpu {#keys}│",
"showPeCoreCount": true
},
{
"type": "disk",
"key": "│ 󰉉 root {#keys}│",
"folders": "/"
},
{
"type": "disk",
"key": "│ 󰉉 home {#keys}│",
"folders": "/home"
},
{
"type": "disk",
"key": "│ 󰉉 media {#keys}│",
"folders": "/media"
},
{
"type": "memory",
"key": "│  memory {#keys}│"
},
{
"type": "custom",
"key": "├───────────┤"
},
{
"type": "colors",
"key": "│  colors {#keys}│",
"symbol": "circle"
},
{
"type": "custom",
"key": "╰───────────╯"
}
]
}
+9
View File
@@ -0,0 +1,9 @@
add_newline = true
[character]
success_symbol = "[➜](bold green)"
error_symbol = "[➜](bold red)"
[directory]
style = "bold blue"
truncate_to_repo = true
+1 -63
View File
@@ -3,12 +3,6 @@
# Only imported by desktop and laptop profiles.
{ inputs, pkgs, ... }:
let
# Parse true ASCII Escape (0x1b) and DEL (0x7f) bytes so TOML serialization generates real escape sequences
esc = builtins.fromJSON "\"\\u001b\"";
del = builtins.fromJSON "\"\\u007f\"";
in
{
# Graphical packages managed via Home Manager
home.packages = with pkgs; [
@@ -41,63 +35,7 @@ in
# GPU-Accelerated Terminal Emulator (Alacritty)
programs.alacritty = {
enable = true;
settings = {
general = {
import = [
"~/.config/alacritty/dank-theme.toml"
];
};
font = {
normal = { family = "FiraCode Nerd Font"; style = "Regular"; };
bold = { family = "FiraCode Nerd Font"; style = "Bold"; };
italic = { family = "FiraCode Nerd Font"; style = "Italic"; };
bold_italic = { family = "FiraCode Nerd Font"; style = "Bold Italic"; };
size = 11.0;
};
window = {
decorations = "None";
padding = { x = 12; y = 12; };
opacity = 1.0;
};
scrolling = {
history = 3023;
};
cursor = {
style = { shape = "Block"; blinking = "On"; };
blink_interval = 500;
unfocused_hollow = true;
};
mouse = {
hide_when_typing = true;
};
selection = {
save_to_clipboard = false;
};
bell = {
duration = 0;
};
keyboard = {
bindings = [
{ key = "C"; mods = "Control|Shift"; action = "Copy"; }
{ key = "V"; mods = "Control|Shift"; action = "Paste"; }
{ key = "N"; mods = "Control|Shift"; action = "SpawnNewInstance"; }
{ key = "Equals"; mods = "Control|Shift"; action = "IncreaseFontSize"; }
{ key = "Minus"; mods = "Control"; action = "DecreaseFontSize"; }
{ key = "Key0"; mods = "Control"; action = "ResetFontSize"; }
{ key = "Enter"; mods = "Shift"; chars = "\n"; }
{ key = "Delete"; mods = "Control"; chars = "${esc}[3;5~"; }
{ key = "Back"; mods = "Control"; chars = "${esc}${del}"; }
];
};
};
settings = builtins.fromTOML (builtins.readFile ./config/alacritty/alacritty.toml);
};
# Firefox configuration
+18
View File
@@ -0,0 +1,18 @@
# --- Word Deletion & Readline Keybindings ---
if [[ -n "$BASH_VERSION" ]] && [[ "$-" == *i* ]]; then
# Ctrl+W: Delete entire word under cursor (backward-word + kill-word)
bind '"\C-w": "\eb\ed"' 2>/dev/null
# Ctrl+Delete: Forward word delete (matches Alacritty \e[3;5~)
bind '"\e[3;5~": kill-word' 2>/dev/null
# Ctrl+Backspace / Alt+Backspace: Backward word delete (start to cursor)
bind '"\e\x7f": backward-kill-word' 2>/dev/null
bind '"\e\b": backward-kill-word' 2>/dev/null
fi
# --- Visual Entry ---
# Display system information dashboard upon opening interactive shells
if [[ $- == *i* ]]; then
fastfetch --logo none
fi
+1 -11
View File
@@ -12,16 +12,6 @@
programs.starship = {
enable = true;
enableBashIntegration = true; # Mount prompt configuration inside Bash shells
settings = {
add_newline = true;
character = {
success_symbol = "[➜](bold green)";
error_symbol = "[➜](bold red)";
};
directory = {
style = "bold blue";
truncate_to_repo = true; # Hides directory path prefixes when navigating inside Git repositories
};
};
settings = builtins.fromTOML (builtins.readFile ./config/starship.toml);
};
}