summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--user/settings/zsh.nix18
1 files changed, 16 insertions, 2 deletions
diff --git a/user/settings/zsh.nix b/user/settings/zsh.nix
index 0f97a227..5d62101a 100644
--- a/user/settings/zsh.nix
+++ b/user/settings/zsh.nix
@@ -4,6 +4,20 @@ let
   inherit (pkgs) stdenv;
   lsOptions = if stdenv.isDarwin then "-p" else "-v --group-directories-first";
   lsIsoDate = if stdenv.isDarwin then "" else "--time-style=long-iso";
+  mkZshPlugin = attrs: {
+    name = attrs.name;
+    src = stdenv.mkDerivation {
+      inherit (attrs) src;
+      name = "zsh-plugin-${attrs.name}";
+      buildInputs = [ pkgs.zsh ];
+      buildPhase = ''
+        zsh -c 'for f in **/*; zcompile "$f"'
+      '';
+      installPhase = ''
+        cp -a $PWD $out/
+      '';
+    };
+  };
 in
 {
   home.packages = with pkgs; [
@@ -40,7 +54,7 @@ in
       ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "fg=8";
     };
 
-    plugins = [
+    plugins = (map mkZshPlugin [
       {
         name = "cd-gitroot";
         src = pkgs.fetchFromGitHub {
@@ -112,7 +126,7 @@ in
           sha256 = "1328g3h51478ai25niv9qgf8bjgg3cw98zdqfznrbgw0k3qj66zk";
         };
       }
-    ];
+    ]);
 
     shellAliases = {
       l = "ls ${lsOptions} -Bp";