Files
athenix/sw/theme.nix
UGA Innovation Factory 67e7a57402
All checks were successful
CI / Format Check (push) Successful in 3s
CI / Flake Check (push) Successful in 1m42s
CI / Evaluate Key Configurations (nix-builder) (push) Successful in 10s
CI / Evaluate Key Configurations (nix-desktop1) (push) Successful in 11s
CI / Evaluate Key Configurations (nix-laptop1) (push) Successful in 7s
CI / Evaluate Artifacts (installer-iso-nix-laptop1) (push) Successful in 16s
CI / Evaluate Artifacts (lxc-nix-builder) (push) Successful in 11s
fix: Set proper keybindings for zsh
2026-01-13 12:16:46 -05:00

94 lines
2.5 KiB
Nix

{
pkgs,
config,
osConfig,
lib,
...
}:
# ============================================================================
# Shell Theme Configuration
# ============================================================================
# This module configures the shell environment (Zsh, Oh My Posh) for users.
# It is imported by default for all users to ensure a consistent experience.
let
# Fetch upstream OMP theme once
jyumppTheme = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/Jyumpp/jyumpp-zsh-theme/refs/heads/master/.jyumpp.omp.json";
hash = "sha256-jsN3hkyT0dJNTYEmDHQPp++oscQLgYGNj7PZAcIW2TA=";
};
# Make a root variant with red username (wraps {{ .UserName }} with ANSI red)
jyumppRootTheme = pkgs.runCommand "jyumpp-root.omp.json" { } ''
sed -E 's|\{\{[[:space:]]*\.UserName[[:space:]]*\}\}|<#FF3B30>{{ .UserName }}</>|g' \
${jyumppTheme} > $out
'';
isRoot = config.home.username == "root";
themeFile = if isRoot then jyumppRootTheme else jyumppTheme;
in
{
config = {
programs.zsh = {
enable = true;
initContent = ''
bindkey '^[[H' beginning-of-line # Home key
bindkey '^[[F' end-of-line # End key
bindkey '^[[3~' delete-char # Delete key
bindkey '^[[1~' beginning-of-line # Alternative Home key
bindkey '^[[4~' end-of-line # Alternative End key
bindkey '^[[2~' overwrite-mode # Insert key
bindkey '^[[5~' up-line-or-history # Page Up
bindkey '^[[6~' down-line-or-history # Page Down
bindkey -e
'';
# Plugins
historySubstringSearch = {
enable = true;
searchDownKey = "^[[B";
searchUpKey = "^[[A";
};
zplug = lib.mkIf (!isRoot) {
enable = true;
plugins = [
{
name = "jeffreytse/zsh-vi-mode";
}
{
name = "BronzeDeer/zsh-completion-sync";
}
];
};
history = {
append = true;
};
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
};
programs.zoxide = lib.mkIf (!isRoot) {
enable = true;
enableZshIntegration = true;
};
programs.lsd = lib.mkIf (!isRoot) {
enable = true;
enableZshIntegration = true;
};
programs.oh-my-posh = {
enable = true;
enableZshIntegration = true;
enableBashIntegration = true;
settings = builtins.fromJSON (builtins.unsafeDiscardStringContext (builtins.readFile themeFile));
};
};
}