Compare commits

...

8 Commits

4 changed files with 68 additions and 34 deletions

View File

@ -93,7 +93,7 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.activation.emacsCompile = lib.hm.dag.entryAfter [ "linkGeneration" ] '' home.activation.emacsCompile = lib.hm.dag.entryAfter [ "linkGeneration" ] ''
${config.programs.emacs.finalPackage}/bin/emacs --batch \ run ${config.programs.emacs.finalPackage}/bin/emacs --batch \
--eval '(setq warning-minimum-log-level :error)' \ --eval '(setq warning-minimum-log-level :error)' \
--eval '(byte-compile-file "${config.xdg.configHome}/emacs/early-init.el")' \ --eval '(byte-compile-file "${config.xdg.configHome}/emacs/early-init.el")' \
--eval '(byte-compile-file "${config.xdg.configHome}/emacs/init.el")' --eval '(byte-compile-file "${config.xdg.configHome}/emacs/init.el")'

View File

@ -41,6 +41,8 @@ let
sha256 = "sha256-ES5vJXHjAKw/VHjWs8Au/3R+/aotSbY7PWnWAMzCR8E="; sha256 = "sha256-ES5vJXHjAKw/VHjWs8Au/3R+/aotSbY7PWnWAMzCR8E=";
}); });
sudo = makePlugin "sudo" "sudo.plugin.zsh" "${pkgs.oh-my-zsh}/share/oh-my-zsh/plugins/sudo"; sudo = makePlugin "sudo" "sudo.plugin.zsh" "${pkgs.oh-my-zsh}/share/oh-my-zsh/plugins/sudo";
extract = makePlugin "extract" "extract.plugin.zsh" "${pkgs.oh-my-zsh}/share/oh-my-zsh/plugins/extract";
}; };
in in
@ -51,6 +53,11 @@ in
example = "p10k"; example = "p10k";
default = "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 { config = lib.mkIf cfg.enable {
@ -60,9 +67,7 @@ in
home.file = lib.mkMerge [ home.file = lib.mkMerge [
(builtins.foldl' (a: b: a // b) { } (builtins.map (plugin: { ${plugin.path}.source = plugin.src; }) (builtins.attrValues extraPlugins))) (builtins.foldl' (a: b: a // b) { } (builtins.map (plugin: { ${plugin.path}.source = plugin.src; }) (builtins.attrValues extraPlugins)))
{ "${relToDotDir ".zshrc"}".text = lib.mkAfter '' { "${relToDotDir ".zshrc"}".text = lib.mkAfter cfg.endConfig; }
${lib.optionalString config.programs.wezterm.enable "source \"${config.programs.wezterm.package}/etc/profile.d/wezterm.sh\""}
''; }
]; ];
programs.zsh = { programs.zsh = {
@ -85,21 +90,28 @@ in
initExtraFirst = '' initExtraFirst = ''
${makeIfVar "__MATERUS_HM_ZSH_PROMPT" "p10k" '' ${makeIfVar "__MATERUS_HM_ZSH_PROMPT" "p10k" ''
if [[ -r "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" ]]; then if [[ -r "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" ]]; then
source "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" source "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh"
fi fi
if zmodload zsh/terminfo && (( "$terminfo[colors]" >= "256" )); then if [[ -f "${extraPlugins.powerlevel10k.fullPath}" ]]; then
__MATERUS_HM_ZSH_256COLORS="''${__MATERUS_HM_ZSH_256COLORS:-1}"; else source "${extraPlugins.powerlevel10k.fullPath}"
__MATERUS_HM_ZSH_256COLORS="''${__MATERUS_HM_ZSH_256COLORS:-0}"; fi
fi ''
if [[ -f "${extraPlugins.powerlevel10k.fullPath}" ]]; then }
source "${extraPlugins.powerlevel10k.fullPath}" if zmodload zsh/terminfo && (( "$terminfo[colors]" >= "256" )); then
fi __MATERUS_HM_ZSH_256COLORS="''${__MATERUS_HM_ZSH_256COLORS:-1}"; else
if [[ -f "${extraPlugins.sudo.fullPath}" ]]; then __MATERUS_HM_ZSH_256COLORS="''${__MATERUS_HM_ZSH_256COLORS:-0}";
source "${extraPlugins.sudo.fullPath}" fi
fi
'' if [[ -f "${extraPlugins.sudo.fullPath}" ]]; then
}''; source "${extraPlugins.sudo.fullPath}"
fi
if [[ -f "${extraPlugins.extract.fullPath}" ]]; then
source "${extraPlugins.extract.fullPath}"
path+="${extraPlugins.extract.path}"
fpath+="${extraPlugins.extract.path}"
fi
'';

View File

@ -1,31 +1,44 @@
{ config, lib, materusArg, pkgs, ... }: { config, lib, materusArg, pkgs, ... }:
let let
cfg = config.materus.profile.wezterm; cfg = config.materus.profile.wezterm;
cfgText = '' zshCfg = ''
config.hide_tab_bar_if_only_one_tab = true; source "${config.programs.wezterm.package}/etc/profile.d/wezterm.sh"
config.enable_scroll_bar = true;
config.font = wezterm.font 'Hack Nerd Font';
''; '';
in in
{ {
options.materus.profile.wezterm.enable = materusArg.pkgs.lib.mkBoolOpt config.materus.profile.enableDesktop "Enable materus wezterm config"; 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.enableHackFont = materusArg.pkgs.lib.mkBoolOpt true "Enable hack nerd font for wezterm";
options.materus.profile.wezterm.config = lib.mkOption { options.materus.profile.wezterm.enableWezcraft = materusArg.pkgs.lib.mkBoolOpt true "Enable alias to start wezcraft with monocraft font";
default = cfgText; options.materus.profile.wezterm.extraConfig = lib.mkOption {
default = "";
description = "Config for wezterm"; description = "Config for wezterm";
type = lib.types.string; type = lib.types.lines;
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable
programs.wezterm.enable = true; {
programs.wezterm.colorSchemes = { }; programs.wezterm.enable = true;
programs.wezterm.extraConfig = '' programs.wezterm.colorSchemes = { };
local config = wezterm.config_builder(); programs.wezterm.extraConfig = ''
${cfgText} 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; 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))
(lib.mkIf cfg.enableWezcraft (pkgs.writeShellScriptBin "wezcraft" ''
${lib.getExe config.programs.wezterm.package} --config font="wezterm.font 'Monocraft Nerd Font'" $@
''))
];
materus.profile.zsh.endConfig = lib.optionalString cfg.enableWezcraft zshCfg;
};
} }

View File

@ -0,0 +1,9 @@
local wezterm_config = {};
function materus_wezterm_config()
local wezterm = require 'wezterm';
local cfg = wezterm.config_builder();
cfg.hide_tab_bar_if_only_one_tab = true;
cfg.enable_scroll_bar = true;
return cfg;
end