diff options
Diffstat (limited to '')
-rw-r--r-- | modules/by-name/zs/zsh/module.nix | 56 |
1 files changed, 35 insertions, 21 deletions
diff --git a/modules/by-name/zs/zsh/module.nix b/modules/by-name/zs/zsh/module.nix index cb1bb086..fee2eae3 100644 --- a/modules/by-name/zs/zsh/module.nix +++ b/modules/by-name/zs/zsh/module.nix @@ -1,23 +1,49 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, - shell_library, - system, ... }: let cfg = config.soispha.programs.zsh; - zDotDir = ".config/zsh"; + zDotDir = "${config.home-manager.users.soispha.xdg.configHome}/zsh"; sourceFile = path: "source ${path}\n"; + + extraFiles = builtins.concatStringsSep "\n" ( + builtins.map (value: + if builtins.isPath value + then (sourceFile value) + else value) ( + builtins.attrValues cfg.integrations + ) + ); in { options.soispha.programs.zsh = { enable = lib.mkEnableOption "zsh"; + + integrations = lib.mkOption { + type = lib.types.attrsOf (lib.types.either lib.types.path lib.types.str); + example = '' + { + atuin = ./integrations/atuin.zsh; + } + ''; + default = {}; + }; }; config = lib.mkIf cfg.enable { environment.variables = { - ZDOTDIR = "${config.home-manager.users.soispha.home.homeDirectory}/${zDotDir}"; + ZDOTDIR = zDotDir; }; home-manager.users.soispha = { @@ -38,8 +64,6 @@ in { autocd = true; - # Must be relative to the users home directory (for whatever reason) - # Thus no `${homeConfig.xdg.configHome}` dotDir = zDotDir; # TODO: Remove the whole history and replace it completely with `atuin` <2024-10-21> @@ -75,17 +99,9 @@ in { setopt VI ''; - initExtraFirst = - sourceFile ./config/zsh-init.zsh - + '' - SHELL_LIBRARY_VERSION="2.1.2" source ${shell_library.rawLib.${system}} - ''; - - initExtra = let + initContent = let start = lib.modules.mkBefore ( - # NOTE: This must be before the insult, as we otherwise override the previous handler <2024-02-28> - sourceFile ./config/command_not_found/command_not_found.sh - + sourceFile ./config/command_not_found/command_not_found_insult.sh + sourceFile ./config/zsh-init.zsh + sourceFile ./config/custom_cursor.zsh + sourceFile ./config/edit_command_line.zsh + sourceFile ./plugins/zsh-history-substring-search.zsh @@ -105,6 +121,9 @@ in { lib.modules.mkMerge [ start + + extraFiles + end ]; @@ -112,11 +131,6 @@ in { HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND = "bg=cyan,fg=white"; HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND = "fg=red,underline,standout,bold"; }; - - shellAliases = { - ll = ". ll"; - lm = ". lm"; - }; }; }; }; |