about summary refs log tree commit diff stats
path: root/modules/by-name/zs/zsh/module.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/by-name/zs/zsh/module.nix40
1 files changed, 21 insertions, 19 deletions
diff --git a/modules/by-name/zs/zsh/module.nix b/modules/by-name/zs/zsh/module.nix
index b50e72ac..bf7e2a71 100644
--- a/modules/by-name/zs/zsh/module.nix
+++ b/modules/by-name/zs/zsh/module.nix
@@ -1,8 +1,17 @@
+# 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,
+  pkgs,
   ...
 }: let
   cfg = config.soispha.programs.zsh;
@@ -12,7 +21,10 @@
   sourceFile = path: "source ${path}\n";
 
   extraFiles = builtins.concatStringsSep "\n" (
-    builtins.map sourceFile (
+    builtins.map (value:
+      if builtins.isPath value
+      then (sourceFile value)
+      else value) (
       builtins.attrValues cfg.integrations
     )
   );
@@ -21,7 +33,7 @@ in {
     enable = lib.mkEnableOption "zsh";
 
     integrations = lib.mkOption {
-      type = lib.types.attrsOf lib.types.path;
+      type = lib.types.attrsOf (lib.types.either lib.types.path lib.types.str);
       example = ''
         {
           atuin = ./integrations/atuin.zsh;
@@ -91,23 +103,18 @@ 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
           );
           end = lib.modules.mkAfter (
-            sourceFile ./config/keymaps_start.zsh
+            # NOTE(@bpeetz): Put this here, so that command handler in `extraFiles`
+            # are not overriding this. <2025-05-16>
+            sourceFile ./config/command_not_found/command_not_found_insult.sh
+            + sourceFile ./config/keymaps_start.zsh
             + sourceFile ./config/keymaps/command.zsh
             + sourceFile ./config/keymaps/emacs.zsh
             + sourceFile ./config/keymaps/isearch.zsh
@@ -131,11 +138,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";
-        };
       };
     };
   };