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.nix50
1 files changed, 33 insertions, 17 deletions
diff --git a/modules/by-name/zs/zsh/module.nix b/modules/by-name/zs/zsh/module.nix
index cb1bb086..644854a2 100644
--- a/modules/by-name/zs/zsh/module.nix
+++ b/modules/by-name/zs/zsh/module.nix
@@ -1,8 +1,15 @@
+# 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;
@@ -10,9 +17,28 @@
   zDotDir = ".config/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 {
@@ -75,17 +101,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 +123,9 @@ in {
           lib.modules.mkMerge
           [
             start
+
+            extraFiles
+
             end
           ];
 
@@ -112,11 +133,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";
-        };
       };
     };
   };