zsh: add package option (#3945)

Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
Christoph Heiss 2023-05-11 01:54:34 +02:00 committed by GitHub
parent 983f8a1bb9
commit 010c269877
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -215,6 +215,8 @@ in
programs.zsh = { programs.zsh = {
enable = mkEnableOption "Z shell (Zsh)"; enable = mkEnableOption "Z shell (Zsh)";
package = mkPackageOption pkgs "zsh" { };
autocd = mkOption { autocd = mkOption {
default = null; default = null;
description = '' description = ''
@ -482,8 +484,8 @@ in
} }
{ {
home.packages = with pkgs; [ zsh ] home.packages = [ cfg.package ]
++ optional cfg.enableCompletion nix-zsh-completions ++ optional cfg.enableCompletion pkgs.nix-zsh-completions
++ optional cfg.oh-my-zsh.enable cfg.oh-my-zsh.package; ++ optional cfg.oh-my-zsh.enable cfg.oh-my-zsh.package;
home.file."${relToDotDir ".zshrc"}".text = concatStringsSep "\n" ([ home.file."${relToDotDir ".zshrc"}".text = concatStringsSep "\n" ([
@ -499,7 +501,7 @@ in
fpath+=($profile/share/zsh/site-functions $profile/share/zsh/$ZSH_VERSION/functions $profile/share/zsh/vendor-completions) fpath+=($profile/share/zsh/site-functions $profile/share/zsh/$ZSH_VERSION/functions $profile/share/zsh/vendor-completions)
done done
HELPDIR="${pkgs.zsh}/share/zsh/$ZSH_VERSION/help" HELPDIR="${cfg.package}/share/zsh/$ZSH_VERSION/help"
'' ''
(optionalString (cfg.defaultKeymap != null) '' (optionalString (cfg.defaultKeymap != null) ''