From d3984da4b4f7d73af772c7dbaf35cae1a4ef1812 Mon Sep 17 00:00:00 2001 From: 0xrsydn Date: Fri, 26 Sep 2025 16:30:57 +0700 Subject: [PATCH] chore:fix nix final --- modules/home/rsydn/shell/zsh.nix | 44 ++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/modules/home/rsydn/shell/zsh.nix b/modules/home/rsydn/shell/zsh.nix index 9619eba..fba0088 100644 --- a/modules/home/rsydn/shell/zsh.nix +++ b/modules/home/rsydn/shell/zsh.nix @@ -1,6 +1,6 @@ { config, lib, pkgs, ... }: let - inherit (lib) mkEnableOption mkIf mkOption types; + inherit (lib) mkEnableOption mkIf mkMerge mkOption types; cfg = config.rsydn.shell.zsh; in { options.rsydn.shell.zsh = { @@ -60,24 +60,30 @@ in { }; }; - config = mkIf cfg.enable { - programs.zsh = { - enable = true; - enableCompletion = true; - autosuggestion.enable = cfg.enableAutoSuggestion; - syntaxHighlighting.enable = cfg.enableSyntaxHighlighting; - shellAliases = cfg.aliases; - initExtraBeforeCompInit = cfg.extraBeforeCompInit; - initExtraFirst = lib.optionalString cfg.enableVimMode '' + config = mkIf cfg.enable (mkMerge [ + { + programs.zsh = { + enable = true; + enableCompletion = true; + autosuggestion.enable = cfg.enableAutoSuggestion; + 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.enableVimMode { + programs.zsh.initContent = lib.mkBefore '' bindkey -v ''; - initExtra = cfg.extraAfter; - - oh-my-zsh = { - enable = true; - theme = cfg.theme; - plugins = cfg.plugins; - }; - }; - }; + }) + ]); }