Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions modules/zsh/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -213,6 +251,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 "source <(fzf --zsh)")
(lib.optionalString ing.atuin.enable ''eval "$(atuin init zsh)"'')
Expand Down Expand Up @@ -264,6 +310,10 @@ in
"--histexpand" = cfg.history.expanded;
};

postHook = "
zinit plugins
";

env.ZDOTDIR = builtins.toString (
config.pkgs.linkFarm "zsh-merged-config" [
{
Expand Down
Loading