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 'modules/by-name/zs/zsh/module.nix')
-rw-r--r--modules/by-name/zs/zsh/module.nix42
1 files changed, 18 insertions, 24 deletions
diff --git a/modules/by-name/zs/zsh/module.nix b/modules/by-name/zs/zsh/module.nix
index fd99031b..fee2eae3 100644
--- a/modules/by-name/zs/zsh/module.nix
+++ b/modules/by-name/zs/zsh/module.nix
@@ -1,19 +1,28 @@
+# 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;
 
-  zDotDir = ".config/zsh";
+  zDotDir = "${config.home-manager.users.soispha.xdg.configHome}/zsh";
 
   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
     )
   );
@@ -22,7 +31,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;
@@ -34,7 +43,7 @@ in {
 
   config = lib.mkIf cfg.enable {
     environment.variables = {
-      ZDOTDIR = "${config.home-manager.users.soispha.home.homeDirectory}/${zDotDir}";
+      ZDOTDIR = zDotDir;
     };
 
     home-manager.users.soispha = {
@@ -55,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>
@@ -92,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
@@ -132,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 = ". ${lib.getExe pkgs.ll}";
-          lm = ". ${lib.getExe pkgs.lm}";
-        };
       };
     };
   };