mirror of
				https://github.com/materusPL/nixos-config
				synced 2025-11-04 06:20:27 +01:00 
			
		
		
		
	Compare commits
	
		
			8 Commits
		
	
	
		
			8b1d9ff963
			...
			61ca7ef3bb
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 61ca7ef3bb | |||
| 62c24e24b8 | |||
| 2a65700253 | |||
| eceae11a41 | |||
| b925022a9e | |||
| ee7bcb1c0d | |||
| a1eccd4d77 | |||
| 369ed384a4 | 
@ -93,7 +93,7 @@ in
 | 
			
		||||
 | 
			
		||||
  config = lib.mkIf cfg.enable {
 | 
			
		||||
    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 '(byte-compile-file "${config.xdg.configHome}/emacs/early-init.el")' \
 | 
			
		||||
      --eval '(byte-compile-file "${config.xdg.configHome}/emacs/init.el")'
 | 
			
		||||
 | 
			
		||||
@ -41,6 +41,8 @@ let
 | 
			
		||||
      sha256 = "sha256-ES5vJXHjAKw/VHjWs8Au/3R+/aotSbY7PWnWAMzCR8E=";
 | 
			
		||||
    });
 | 
			
		||||
    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
 | 
			
		||||
@ -51,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 {
 | 
			
		||||
@ -60,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 = {
 | 
			
		||||
@ -85,21 +90,28 @@ in
 | 
			
		||||
      initExtraFirst = ''
 | 
			
		||||
 | 
			
		||||
        ${makeIfVar "__MATERUS_HM_ZSH_PROMPT" "p10k" ''
 | 
			
		||||
            if [[ -r "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" ]]; then
 | 
			
		||||
              source "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh"
 | 
			
		||||
            fi
 | 
			
		||||
            if zmodload zsh/terminfo && (( "$terminfo[colors]" >= "256" )); then 
 | 
			
		||||
              __MATERUS_HM_ZSH_256COLORS="''${__MATERUS_HM_ZSH_256COLORS:-1}"; else
 | 
			
		||||
              __MATERUS_HM_ZSH_256COLORS="''${__MATERUS_HM_ZSH_256COLORS:-0}"; 
 | 
			
		||||
            fi
 | 
			
		||||
            if [[ -f "${extraPlugins.powerlevel10k.fullPath}" ]]; then
 | 
			
		||||
              source "${extraPlugins.powerlevel10k.fullPath}"
 | 
			
		||||
            fi
 | 
			
		||||
            if [[ -f "${extraPlugins.sudo.fullPath}" ]]; then
 | 
			
		||||
              source "${extraPlugins.sudo.fullPath}"
 | 
			
		||||
            fi
 | 
			
		||||
            ''
 | 
			
		||||
        }'';
 | 
			
		||||
              if [[ -r "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" ]]; then
 | 
			
		||||
                source "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh"
 | 
			
		||||
              fi
 | 
			
		||||
              if [[ -f "${extraPlugins.powerlevel10k.fullPath}" ]]; then
 | 
			
		||||
                source "${extraPlugins.powerlevel10k.fullPath}"
 | 
			
		||||
              fi
 | 
			
		||||
              ''
 | 
			
		||||
        }
 | 
			
		||||
        if zmodload zsh/terminfo && (( "$terminfo[colors]" >= "256" )); then 
 | 
			
		||||
          __MATERUS_HM_ZSH_256COLORS="''${__MATERUS_HM_ZSH_256COLORS:-1}"; else
 | 
			
		||||
          __MATERUS_HM_ZSH_256COLORS="''${__MATERUS_HM_ZSH_256COLORS:-0}"; 
 | 
			
		||||
        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
 | 
			
		||||
        '';
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,31 +1,44 @@
 | 
			
		||||
{ config, lib, materusArg, pkgs, ... }:
 | 
			
		||||
let
 | 
			
		||||
  cfg = config.materus.profile.wezterm;
 | 
			
		||||
  cfgText = ''
 | 
			
		||||
    config.hide_tab_bar_if_only_one_tab = true;
 | 
			
		||||
    config.enable_scroll_bar = true;
 | 
			
		||||
    config.font = wezterm.font 'Hack Nerd Font';
 | 
			
		||||
  zshCfg = ''
 | 
			
		||||
    source "${config.programs.wezterm.package}/etc/profile.d/wezterm.sh"
 | 
			
		||||
  '';
 | 
			
		||||
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.config = lib.mkOption {
 | 
			
		||||
    default = cfgText;
 | 
			
		||||
  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.string;
 | 
			
		||||
    type = lib.types.lines;
 | 
			
		||||
  };
 | 
			
		||||
  config = lib.mkIf cfg.enable {
 | 
			
		||||
    programs.wezterm.enable = true;
 | 
			
		||||
    programs.wezterm.colorSchemes = { };
 | 
			
		||||
    programs.wezterm.extraConfig = ''
 | 
			
		||||
      local config = wezterm.config_builder();
 | 
			
		||||
  config = lib.mkIf cfg.enable
 | 
			
		||||
    {
 | 
			
		||||
      programs.wezterm.enable = true;
 | 
			
		||||
      programs.wezterm.colorSchemes = { };
 | 
			
		||||
      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;
 | 
			
		||||
    '';
 | 
			
		||||
 | 
			
		||||
    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;
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										9
									
								
								extraFiles/config/wezterm/wezterm_config.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								extraFiles/config/wezterm/wezterm_config.lua
									
									
									
									
									
										Normal 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
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user