From a6c392c9bd82d3ff1120b2cd11418b85f2c7dbdb Mon Sep 17 00:00:00 2001 From: Mrid22 Date: Sat, 21 Feb 2026 20:29:49 +0200 Subject: [PATCH 1/5] modules/zsh: add zinit support Add zinit pm options --- modules/zsh/module.nix | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/modules/zsh/module.nix b/modules/zsh/module.nix index e7ddf06..73ae5c5 100644 --- a/modules/zsh/module.nix +++ b/modules/zsh/module.nix @@ -33,6 +33,44 @@ in description = "cd into a directory just by typing it in"; }; + plugins = { + zinit = { + enable = lib.mkEnableOption "zinit"; + package = lib.mkOption { + type = lib.types.package; + default = config.pkgs.zinit; + }; + light = lib.mkOption { + type = with lib.types; listOf str; + default = [ ]; + }; + load = lib.mkOption { + type = with lib.types; listOf str; + default = [ ]; + }; + oh-my-zsh = { + plugins = lib.mkOption { + type = with lib.types; listOf str; + default = [ ]; + }; + themes = lib.mkOption { + type = with lib.types; listOf str; + default = [ ]; + }; + libs = lib.mkOption { + type = with lib.types; listOf str; + default = [ ]; + }; + }; + prezto = { + plugins = lib.mkOption { + type = with lib.types; listOf str; + default = [ ]; + }; + }; + }; + }; + integrations = { fzf = { enable = lib.mkEnableOption "fzf"; @@ -207,6 +245,14 @@ in ''} '') + "# Plugins" + (lib.optionalString cfg.plugins.zinit.enable "source ${config.pkgs.zinit}/share/zinit/zinit.zsh") + (lib.concatMapStringsSep "\n" (p: "zinit light ${p}") cfg.plugins.zinit.light) + (lib.concatMapStringsSep "\n" (p: "zinit load${p}") cfg.plugins.zinit.load) + (lib.concatMapStringsSep "\n" (p: "zinit snippet OMZP::${p}") cfg.plugins.zinit.oh-my-zsh.plugins) + (lib.concatMapStringsSep "\n" (p: "zinit snippet OMZT::${p}") cfg.plugins.zinit.oh-my-zsh.themes) + (lib.concatMapStringsSep "\n" (p: "zinit snippet OMZL::${p}") cfg.plugins.zinit.oh-my-zsh.libs) + (lib.concatMapStringsSep "\n" (p: "zinit snippet PZT::${p}") cfg.plugins.zinit.prezto.plugins) "# Integrations" (lib.optionalString ing.fzf.enable "eval $(fzf --zsh)") (lib.optionalString ing.atuin.enable ''eval "$(atuin init zsh)"'') From f54d02fead2eddedae942d749843736a8d2956b2 Mon Sep 17 00:00:00 2001 From: Mrid22 Date: Mon, 23 Feb 2026 14:26:44 +0200 Subject: [PATCH 2/5] testing postHook --- modules/zsh/module.nix | 59 ++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/modules/zsh/module.nix b/modules/zsh/module.nix index fb959df..6b3c145 100644 --- a/modules/zsh/module.nix +++ b/modules/zsh/module.nix @@ -3,11 +3,9 @@ lib, wlib, ... -}: -let +}: let cfg = config.settings; -in -{ +in { _class = "wrapper"; options = { settings = { @@ -23,7 +21,7 @@ in shellAliases = lib.mkOption { type = with lib.types; attrsOf str; - default = { }; + default = {}; description = "shell aliases (alias -- key=value)"; }; @@ -42,30 +40,30 @@ in }; light = lib.mkOption { type = with lib.types; listOf str; - default = [ ]; + default = []; }; load = lib.mkOption { type = with lib.types; listOf str; - default = [ ]; + default = []; }; oh-my-zsh = { plugins = lib.mkOption { type = with lib.types; listOf str; - default = [ ]; + default = []; }; themes = lib.mkOption { type = with lib.types; listOf str; - default = [ ]; + default = []; }; libs = lib.mkOption { type = with lib.types; listOf str; - default = [ ]; + default = []; }; }; prezto = { plugins = lib.mkOption { type = with lib.types; listOf str; - default = [ ]; + default = []; }; }; }; @@ -108,7 +106,7 @@ in }; flags = lib.mkOption { type = with lib.types; listOf str; - default = [ ]; + default = []; }; }; }; @@ -139,7 +137,7 @@ in "match_prev_cmd" ] ); - default = [ "history" ]; + default = ["history"]; }; }; @@ -213,22 +211,20 @@ in description = "extra stuff to put in .zshrc, gets appended *after* all of the options"; }; - ".zshrc" = - let - zoxide-flags = lib.concatStringsSep " " cfg.integrations.zoxide.flags; - ing = cfg.integrations; - in + ".zshrc" = let + zoxide-flags = lib.concatStringsSep " " cfg.integrations.zoxide.flags; + ing = cfg.integrations; + in lib.mkOption { type = wlib.types.file config.pkgs; default.content = builtins.concatStringsSep "\n" [ "# KeyMap" ( - if cfg.keyMap == "viins" then - "bindkey -a" - else if cfg.keyMap == "vicmd" then - "bindkey -v" - else - "bindkey -e" + if cfg.keyMap == "viins" + then "bindkey -a" + else if cfg.keyMap == "vicmd" + then "bindkey -v" + else "bindkey -e" ) (lib.optionalString cfg.autocd "setopt autocd") @@ -242,9 +238,9 @@ in "#Autosuggestions" (lib.optionalString cfg.autoSuggestions.enable '' source ${config.pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh - ${lib.optionalString (cfg.autoSuggestions.strategy != [ ]) '' - ZSH_AUTOSUGGEST_STRATEGY=(${lib.concatStringsSep " " cfg.autoSuggestions.strategy}) - ''} + ${lib.optionalString (cfg.autoSuggestions.strategy != []) '' + ZSH_AUTOSUGGEST_STRATEGY=(${lib.concatStringsSep " " cfg.autoSuggestions.strategy}) + ''} ${lib.optionalString (cfg.autoSuggestions.highlight != null) '' ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE=(${cfg.autoSuggestions.highlight}) @@ -287,10 +283,9 @@ in config = { package = config.pkgs.zsh; - extraPackages = - let - ing = cfg.integrations; - in + extraPackages = let + ing = cfg.integrations; + in lib.optional ing.fzf.enable ing.fzf.package ++ lib.optional ing.atuin.enable ing.atuin.package ++ lib.optional ing.zoxide.enable ing.zoxide.package @@ -310,6 +305,8 @@ in "--histexpand" = cfg.history.expanded; }; + postHook = "dsf"; + env.ZDOTDIR = builtins.toString ( config.pkgs.linkFarm "zsh-merged-config" [ { From 7a15c2c084ca9228274bf569bfbd75320b6e72d0 Mon Sep 17 00:00:00 2001 From: Mrid22 Date: Mon, 23 Feb 2026 14:26:54 +0200 Subject: [PATCH 3/5] format --- modules/zsh/module.nix | 57 +++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/modules/zsh/module.nix b/modules/zsh/module.nix index 6b3c145..51ef9b1 100644 --- a/modules/zsh/module.nix +++ b/modules/zsh/module.nix @@ -3,9 +3,11 @@ lib, wlib, ... -}: let +}: +let cfg = config.settings; -in { +in +{ _class = "wrapper"; options = { settings = { @@ -21,7 +23,7 @@ in { shellAliases = lib.mkOption { type = with lib.types; attrsOf str; - default = {}; + default = { }; description = "shell aliases (alias -- key=value)"; }; @@ -40,30 +42,30 @@ in { }; light = lib.mkOption { type = with lib.types; listOf str; - default = []; + default = [ ]; }; load = lib.mkOption { type = with lib.types; listOf str; - default = []; + default = [ ]; }; oh-my-zsh = { plugins = lib.mkOption { type = with lib.types; listOf str; - default = []; + default = [ ]; }; themes = lib.mkOption { type = with lib.types; listOf str; - default = []; + default = [ ]; }; libs = lib.mkOption { type = with lib.types; listOf str; - default = []; + default = [ ]; }; }; prezto = { plugins = lib.mkOption { type = with lib.types; listOf str; - default = []; + default = [ ]; }; }; }; @@ -106,7 +108,7 @@ in { }; flags = lib.mkOption { type = with lib.types; listOf str; - default = []; + default = [ ]; }; }; }; @@ -137,7 +139,7 @@ in { "match_prev_cmd" ] ); - default = ["history"]; + default = [ "history" ]; }; }; @@ -211,20 +213,22 @@ in { description = "extra stuff to put in .zshrc, gets appended *after* all of the options"; }; - ".zshrc" = let - zoxide-flags = lib.concatStringsSep " " cfg.integrations.zoxide.flags; - ing = cfg.integrations; - in + ".zshrc" = + let + zoxide-flags = lib.concatStringsSep " " cfg.integrations.zoxide.flags; + ing = cfg.integrations; + in lib.mkOption { type = wlib.types.file config.pkgs; default.content = builtins.concatStringsSep "\n" [ "# KeyMap" ( - if cfg.keyMap == "viins" - then "bindkey -a" - else if cfg.keyMap == "vicmd" - then "bindkey -v" - else "bindkey -e" + if cfg.keyMap == "viins" then + "bindkey -a" + else if cfg.keyMap == "vicmd" then + "bindkey -v" + else + "bindkey -e" ) (lib.optionalString cfg.autocd "setopt autocd") @@ -238,9 +242,9 @@ in { "#Autosuggestions" (lib.optionalString cfg.autoSuggestions.enable '' source ${config.pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh - ${lib.optionalString (cfg.autoSuggestions.strategy != []) '' - ZSH_AUTOSUGGEST_STRATEGY=(${lib.concatStringsSep " " cfg.autoSuggestions.strategy}) - ''} + ${lib.optionalString (cfg.autoSuggestions.strategy != [ ]) '' + ZSH_AUTOSUGGEST_STRATEGY=(${lib.concatStringsSep " " cfg.autoSuggestions.strategy}) + ''} ${lib.optionalString (cfg.autoSuggestions.highlight != null) '' ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE=(${cfg.autoSuggestions.highlight}) @@ -283,9 +287,10 @@ in { config = { package = config.pkgs.zsh; - extraPackages = let - ing = cfg.integrations; - in + extraPackages = + let + ing = cfg.integrations; + in lib.optional ing.fzf.enable ing.fzf.package ++ lib.optional ing.atuin.enable ing.atuin.package ++ lib.optional ing.zoxide.enable ing.zoxide.package From 807ee85b2df38892608d4136478d7911afa007af Mon Sep 17 00:00:00 2001 From: Mrid22 Date: Mon, 23 Feb 2026 15:24:33 +0200 Subject: [PATCH 4/5] trying to compare installed zinit plugins with nix list --- modules/zsh/module.nix | 61 ++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 32 deletions(-) diff --git a/modules/zsh/module.nix b/modules/zsh/module.nix index 51ef9b1..e963232 100644 --- a/modules/zsh/module.nix +++ b/modules/zsh/module.nix @@ -3,11 +3,9 @@ lib, wlib, ... -}: -let +}: let cfg = config.settings; -in -{ +in { _class = "wrapper"; options = { settings = { @@ -23,7 +21,7 @@ in shellAliases = lib.mkOption { type = with lib.types; attrsOf str; - default = { }; + default = {}; description = "shell aliases (alias -- key=value)"; }; @@ -42,30 +40,30 @@ in }; light = lib.mkOption { type = with lib.types; listOf str; - default = [ ]; + default = []; }; load = lib.mkOption { type = with lib.types; listOf str; - default = [ ]; + default = []; }; oh-my-zsh = { plugins = lib.mkOption { type = with lib.types; listOf str; - default = [ ]; + default = []; }; themes = lib.mkOption { type = with lib.types; listOf str; - default = [ ]; + default = []; }; libs = lib.mkOption { type = with lib.types; listOf str; - default = [ ]; + default = []; }; }; prezto = { plugins = lib.mkOption { type = with lib.types; listOf str; - default = [ ]; + default = []; }; }; }; @@ -108,7 +106,7 @@ in }; flags = lib.mkOption { type = with lib.types; listOf str; - default = [ ]; + default = []; }; }; }; @@ -139,7 +137,7 @@ in "match_prev_cmd" ] ); - default = [ "history" ]; + default = ["history"]; }; }; @@ -213,22 +211,20 @@ in description = "extra stuff to put in .zshrc, gets appended *after* all of the options"; }; - ".zshrc" = - let - zoxide-flags = lib.concatStringsSep " " cfg.integrations.zoxide.flags; - ing = cfg.integrations; - in + ".zshrc" = let + zoxide-flags = lib.concatStringsSep " " cfg.integrations.zoxide.flags; + ing = cfg.integrations; + in lib.mkOption { type = wlib.types.file config.pkgs; default.content = builtins.concatStringsSep "\n" [ "# KeyMap" ( - if cfg.keyMap == "viins" then - "bindkey -a" - else if cfg.keyMap == "vicmd" then - "bindkey -v" - else - "bindkey -e" + if cfg.keyMap == "viins" + then "bindkey -a" + else if cfg.keyMap == "vicmd" + then "bindkey -v" + else "bindkey -e" ) (lib.optionalString cfg.autocd "setopt autocd") @@ -242,9 +238,9 @@ in "#Autosuggestions" (lib.optionalString cfg.autoSuggestions.enable '' source ${config.pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh - ${lib.optionalString (cfg.autoSuggestions.strategy != [ ]) '' - ZSH_AUTOSUGGEST_STRATEGY=(${lib.concatStringsSep " " cfg.autoSuggestions.strategy}) - ''} + ${lib.optionalString (cfg.autoSuggestions.strategy != []) '' + ZSH_AUTOSUGGEST_STRATEGY=(${lib.concatStringsSep " " cfg.autoSuggestions.strategy}) + ''} ${lib.optionalString (cfg.autoSuggestions.highlight != null) '' ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE=(${cfg.autoSuggestions.highlight}) @@ -287,10 +283,9 @@ in config = { package = config.pkgs.zsh; - extraPackages = - let - ing = cfg.integrations; - in + extraPackages = let + ing = cfg.integrations; + in lib.optional ing.fzf.enable ing.fzf.package ++ lib.optional ing.atuin.enable ing.atuin.package ++ lib.optional ing.zoxide.enable ing.zoxide.package @@ -310,7 +305,9 @@ in "--histexpand" = cfg.history.expanded; }; - postHook = "dsf"; + postHook = " +zinit plugins +"; env.ZDOTDIR = builtins.toString ( config.pkgs.linkFarm "zsh-merged-config" [ From 73f7973ba8ba0f169c4d5ade4188f2191ad1d43b Mon Sep 17 00:00:00 2001 From: Mrid22 Date: Mon, 23 Feb 2026 15:24:49 +0200 Subject: [PATCH 5/5] format --- modules/zsh/module.nix | 57 +++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/modules/zsh/module.nix b/modules/zsh/module.nix index e963232..19d72d7 100644 --- a/modules/zsh/module.nix +++ b/modules/zsh/module.nix @@ -3,9 +3,11 @@ lib, wlib, ... -}: let +}: +let cfg = config.settings; -in { +in +{ _class = "wrapper"; options = { settings = { @@ -21,7 +23,7 @@ in { shellAliases = lib.mkOption { type = with lib.types; attrsOf str; - default = {}; + default = { }; description = "shell aliases (alias -- key=value)"; }; @@ -40,30 +42,30 @@ in { }; light = lib.mkOption { type = with lib.types; listOf str; - default = []; + default = [ ]; }; load = lib.mkOption { type = with lib.types; listOf str; - default = []; + default = [ ]; }; oh-my-zsh = { plugins = lib.mkOption { type = with lib.types; listOf str; - default = []; + default = [ ]; }; themes = lib.mkOption { type = with lib.types; listOf str; - default = []; + default = [ ]; }; libs = lib.mkOption { type = with lib.types; listOf str; - default = []; + default = [ ]; }; }; prezto = { plugins = lib.mkOption { type = with lib.types; listOf str; - default = []; + default = [ ]; }; }; }; @@ -106,7 +108,7 @@ in { }; flags = lib.mkOption { type = with lib.types; listOf str; - default = []; + default = [ ]; }; }; }; @@ -137,7 +139,7 @@ in { "match_prev_cmd" ] ); - default = ["history"]; + default = [ "history" ]; }; }; @@ -211,20 +213,22 @@ in { description = "extra stuff to put in .zshrc, gets appended *after* all of the options"; }; - ".zshrc" = let - zoxide-flags = lib.concatStringsSep " " cfg.integrations.zoxide.flags; - ing = cfg.integrations; - in + ".zshrc" = + let + zoxide-flags = lib.concatStringsSep " " cfg.integrations.zoxide.flags; + ing = cfg.integrations; + in lib.mkOption { type = wlib.types.file config.pkgs; default.content = builtins.concatStringsSep "\n" [ "# KeyMap" ( - if cfg.keyMap == "viins" - then "bindkey -a" - else if cfg.keyMap == "vicmd" - then "bindkey -v" - else "bindkey -e" + if cfg.keyMap == "viins" then + "bindkey -a" + else if cfg.keyMap == "vicmd" then + "bindkey -v" + else + "bindkey -e" ) (lib.optionalString cfg.autocd "setopt autocd") @@ -238,9 +242,9 @@ in { "#Autosuggestions" (lib.optionalString cfg.autoSuggestions.enable '' source ${config.pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh - ${lib.optionalString (cfg.autoSuggestions.strategy != []) '' - ZSH_AUTOSUGGEST_STRATEGY=(${lib.concatStringsSep " " cfg.autoSuggestions.strategy}) - ''} + ${lib.optionalString (cfg.autoSuggestions.strategy != [ ]) '' + ZSH_AUTOSUGGEST_STRATEGY=(${lib.concatStringsSep " " cfg.autoSuggestions.strategy}) + ''} ${lib.optionalString (cfg.autoSuggestions.highlight != null) '' ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE=(${cfg.autoSuggestions.highlight}) @@ -283,9 +287,10 @@ in { config = { package = config.pkgs.zsh; - extraPackages = let - ing = cfg.integrations; - in + extraPackages = + let + ing = cfg.integrations; + in lib.optional ing.fzf.enable ing.fzf.package ++ lib.optional ing.atuin.enable ing.atuin.package ++ lib.optional ing.zoxide.enable ing.zoxide.package