From f4c08676c4b358250fe8d7d52808839b793ce940 Mon Sep 17 00:00:00 2001 From: 0xrsydn Date: Fri, 26 Sep 2025 18:50:46 +0700 Subject: [PATCH] fix zsh config and add ghostty --- modules/darwin/homebrew.nix | 1 + modules/home/rsydn/base.nix | 1 - modules/home/rsydn/shell/zsh.nix | 46 ++++++++++++++++++++++---------- 3 files changed, 33 insertions(+), 15 deletions(-) diff --git a/modules/darwin/homebrew.nix b/modules/darwin/homebrew.nix index 7378db1..1d765b9 100644 --- a/modules/darwin/homebrew.nix +++ b/modules/darwin/homebrew.nix @@ -44,6 +44,7 @@ in { "visual-studio-code" "google-chrome@canary" "mactex" + "ghostty" ]; description = "Homebrew casks to install."; }; diff --git a/modules/home/rsydn/base.nix b/modules/home/rsydn/base.nix index bbfd0c8..c5f8cac 100644 --- a/modules/home/rsydn/base.nix +++ b/modules/home/rsydn/base.nix @@ -11,7 +11,6 @@ rsydn.shell.zsh = { enable = true; - plugins = [ ]; enableVimMode = true; }; diff --git a/modules/home/rsydn/shell/zsh.nix b/modules/home/rsydn/shell/zsh.nix index 5b753c5..8489ac0 100644 --- a/modules/home/rsydn/shell/zsh.nix +++ b/modules/home/rsydn/shell/zsh.nix @@ -9,13 +9,8 @@ in { theme = mkOption { type = types.str; default = "powerlevel10k/powerlevel10k"; - description = "Oh My Zsh theme name."; - }; - - plugins = mkOption { - type = types.listOf types.str; - default = [ ]; - description = "Oh My Zsh plugins to load."; + description = + "Prompt theme identifier (powerlevel10k supported out of the box)."; }; aliases = mkOption { @@ -38,7 +33,22 @@ in { extraAfter = mkOption { type = types.lines; 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 { @@ -69,15 +79,23 @@ in { syntaxHighlighting.enable = cfg.enableSyntaxHighlighting; shellAliases = cfg.aliases; initExtra = cfg.extraAfter; - - oh-my-zsh = { - enable = true; - theme = cfg.theme; - plugins = cfg.plugins; - }; }; } { 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 { programs.zsh.initContent = lib.mkBefore '' bindkey -v