From eceae11a41fa9b99ea1a68e4659d0884f25f5976 Mon Sep 17 00:00:00 2001 From: materus Date: Sun, 31 Mar 2024 23:07:50 +0200 Subject: [PATCH] home-profile: changes to zsh and wezterm --- configurations/profile/home/shell/zsh.nix | 9 ++++--- .../profile/home/terminal/wezterm.nix | 26 ++++++++++++++----- extraFiles/config/wezterm/wezterm_config.lua | 1 - 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/configurations/profile/home/shell/zsh.nix b/configurations/profile/home/shell/zsh.nix index 5f05409..90832d3 100644 --- a/configurations/profile/home/shell/zsh.nix +++ b/configurations/profile/home/shell/zsh.nix @@ -53,6 +53,11 @@ in example = "p10k"; default = "p10k"; }; + options.materus.profile.zsh.endConfig = lib.mkOption { + default = ""; + description = "Zsh config after all of config"; + type = lib.types.lines; + }; config = lib.mkIf cfg.enable { @@ -62,9 +67,7 @@ in home.file = lib.mkMerge [ (builtins.foldl' (a: b: a // b) { } (builtins.map (plugin: { ${plugin.path}.source = plugin.src; }) (builtins.attrValues extraPlugins))) - { "${relToDotDir ".zshrc"}".text = lib.mkAfter '' - ${lib.optionalString config.programs.wezterm.enable "source \"${config.programs.wezterm.package}/etc/profile.d/wezterm.sh\""} - ''; } + { "${relToDotDir ".zshrc"}".text = lib.mkAfter cfg.endConfig; } ]; programs.zsh = { diff --git a/configurations/profile/home/terminal/wezterm.nix b/configurations/profile/home/terminal/wezterm.nix index 6701e95..5d78755 100644 --- a/configurations/profile/home/terminal/wezterm.nix +++ b/configurations/profile/home/terminal/wezterm.nix @@ -1,28 +1,42 @@ { config, lib, materusArg, pkgs, ... }: let cfg = config.materus.profile.wezterm; + zshCfg = '' + source "${config.programs.wezterm.package}/etc/profile.d/wezterm.sh" + alias 'wezcraft'="wezterm --config font=\"wezterm.font 'Monocraft Nerd Font'\"" + ''; in { options.materus.profile.wezterm.enable = materusArg.pkgs.lib.mkBoolOpt config.materus.profile.enableDesktop "Enable materus wezterm config"; options.materus.profile.wezterm.enableHackFont = materusArg.pkgs.lib.mkBoolOpt true "Enable hack nerd font for wezterm"; + options.materus.profile.wezterm.enableWezcraft = materusArg.pkgs.lib.mkBoolOpt true "Enable alias to start wezcraft with monocraft font"; options.materus.profile.wezterm.extraConfig = lib.mkOption { default = ""; description = "Config for wezterm"; type = lib.types.lines; }; - config = lib.mkIf cfg.enable { - programs.wezterm.enable = true; - programs.wezterm.colorSchemes = { }; - programs.wezterm.extraConfig = '' + config = lib.mkIf cfg.enable + { + programs.wezterm.enable = true; + programs.wezterm.colorSchemes = { }; + programs.wezterm.extraConfig = '' package.path = package.path .. ";${materusArg.cfg.path}/extraFiles/config/wezterm/?.lua" require("wezterm_config"); local config = materus_wezterm_config(); + ${lib.optionalString cfg.enableHackFont "config.font = wezterm.font 'Hack Nerd Font';"} ${cfg.extraConfig} return config; ''; - home.packages = lib.mkIf cfg.enableHackFont [ (pkgs.nerdfonts.override { fonts = [ "Hack" ]; }) ]; - }; + home.packages = [ + (lib.mkIf cfg.enableHackFont (pkgs.nerdfonts.override { + fonts = [ "Hack" ]; + })) + (lib.mkIf cfg.enableWezcraft (pkgs.monocraft)) + ]; + + materus.profile.zsh.endConfig = lib.optionalString cfg.enableWezcraft zshCfg; + }; } diff --git a/extraFiles/config/wezterm/wezterm_config.lua b/extraFiles/config/wezterm/wezterm_config.lua index 2697d6e..75c6eda 100644 --- a/extraFiles/config/wezterm/wezterm_config.lua +++ b/extraFiles/config/wezterm/wezterm_config.lua @@ -5,6 +5,5 @@ function materus_wezterm_config() local cfg = wezterm.config_builder(); cfg.hide_tab_bar_if_only_one_tab = true; cfg.enable_scroll_bar = true; - cfg.font = wezterm.font 'Hack Nerd Font'; return cfg; end