fix zsh config and add ghostty

This commit is contained in:
Rasyidan Akbar F. 2025-09-26 18:50:46 +07:00
commit f4c08676c4
3 changed files with 33 additions and 15 deletions

View file

@ -44,6 +44,7 @@ in {
"visual-studio-code" "visual-studio-code"
"google-chrome@canary" "google-chrome@canary"
"mactex" "mactex"
"ghostty"
]; ];
description = "Homebrew casks to install."; description = "Homebrew casks to install.";
}; };

View file

@ -11,7 +11,6 @@
rsydn.shell.zsh = { rsydn.shell.zsh = {
enable = true; enable = true;
plugins = [ ];
enableVimMode = true; enableVimMode = true;
}; };

View file

@ -9,13 +9,8 @@ in {
theme = mkOption { theme = mkOption {
type = types.str; type = types.str;
default = "powerlevel10k/powerlevel10k"; default = "powerlevel10k/powerlevel10k";
description = "Oh My Zsh theme name."; description =
}; "Prompt theme identifier (powerlevel10k supported out of the box).";
plugins = mkOption {
type = types.listOf types.str;
default = [ ];
description = "Oh My Zsh plugins to load.";
}; };
aliases = mkOption { aliases = mkOption {
@ -38,7 +33,22 @@ in {
extraAfter = mkOption { extraAfter = mkOption {
type = types.lines; type = types.lines;
default = ""; default = "";
description = "Additional script appended after Oh My Zsh loads."; description =
"Additional script appended after the standard zsh setup runs.";
};
promptInit = mkOption {
type = types.lines;
default = "";
description =
"Custom prompt initialization snippet appended after theme setup.";
};
powerlevel10kConfigFile = mkOption {
type = types.nullOr types.path;
default = null;
description =
"Optional path to a Powerlevel10k config that will be linked to ~/.p10k.zsh.";
}; };
enableAutoSuggestion = mkOption { enableAutoSuggestion = mkOption {
@ -69,15 +79,23 @@ in {
syntaxHighlighting.enable = cfg.enableSyntaxHighlighting; syntaxHighlighting.enable = cfg.enableSyntaxHighlighting;
shellAliases = cfg.aliases; shellAliases = cfg.aliases;
initExtra = cfg.extraAfter; initExtra = cfg.extraAfter;
oh-my-zsh = {
enable = true;
theme = cfg.theme;
plugins = cfg.plugins;
};
}; };
} }
{ programs.zsh.initContent = lib.mkOrder 550 cfg.extraBeforeCompInit; } { programs.zsh.initContent = lib.mkOrder 550 cfg.extraBeforeCompInit; }
(mkIf (cfg.theme == "powerlevel10k/powerlevel10k") {
programs.zsh.initExtraFirst = lib.mkBefore ''
source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme
'';
})
(mkIf (cfg.powerlevel10kConfigFile != null) {
home.file.".p10k.zsh".source = cfg.powerlevel10kConfigFile;
programs.zsh.initExtraFirst = lib.mkAfter ''
source ~/.p10k.zsh
'';
})
(mkIf (cfg.promptInit != "") {
programs.zsh.initExtraFirst = lib.mkAfter cfg.promptInit;
})
(mkIf cfg.enableVimMode { (mkIf cfg.enableVimMode {
programs.zsh.initContent = lib.mkBefore '' programs.zsh.initContent = lib.mkBefore ''
bindkey -v bindkey -v