pinwheel: Add enable option for zsh module

This commit is contained in:
Alexander Heldt
2023-11-30 10:22:05 +01:00
parent d3f5eaddb0
commit b363998759
2 changed files with 65 additions and 53 deletions

View File

@@ -19,6 +19,7 @@ in
foot.enable = true; foot.enable = true;
git.enable = true; git.enable = true;
zsh.enable = true;
openvpn.enable = true; openvpn.enable = true;
go.enable = true; go.enable = true;
rust.enable = true; rust.enable = true;

View File

@@ -1,59 +1,70 @@
{ pkgs, lib, ... }: { pkgs, lib, config, ... }:
let
enabled = config.mod.zsh.enable;
in
{ {
home-manager.users.alex = { options = {
programs.zsh = { mod.zsh = {
enable = true; enable = lib.mkEnableOption "enable zsh module";
enableAutosuggestions = true;
enableCompletion = true;
defaultKeymap = "viins";
history = {
ignoreDups = true;
size = 100000;
save = 100000;
};
plugins = [
{
name = "powerlevel10k";
src = pkgs.zsh-powerlevel10k;
file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
}
{
name = "zsh-syntax-highlighting";
src = pkgs.zsh-syntax-highlighting;
}
{
name = "zsh-autosuggestions";
src = pkgs.zsh-autosuggestions;
}
{
name = "zsh-syntax-completions";
src = pkgs.zsh-completions;
}
{
name = "powerlevel10k-config";
src = ./p10k-config;
file = "p10k.zsh";
}
];
envExtra = lib.strings.concatStringsSep "\n" [
"BROWSER=firefox"
];
initExtra = lib.strings.concatStringsSep "\n" [
"export KEYTIMEOUT=1"
"bindkey -v '^?' backward-delete-char"
"bindkey '^a' beginning-of-line"
"bindkey '^e' end-of-line"
];
}; };
}; };
users.users.alex.shell = pkgs.zsh; config = lib.mkIf enabled {
home-manager.users.alex = {
programs.zsh = {
enable = true;
programs.zsh.enable = true; enableAutosuggestions = true;
environment.pathsToLink = [ "/share/zsh" ]; enableCompletion = true;
defaultKeymap = "viins";
history = {
ignoreDups = true;
size = 100000;
save = 100000;
};
plugins = [
{
name = "powerlevel10k";
src = pkgs.zsh-powerlevel10k;
file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
}
{
name = "zsh-syntax-highlighting";
src = pkgs.zsh-syntax-highlighting;
}
{
name = "zsh-autosuggestions";
src = pkgs.zsh-autosuggestions;
}
{
name = "zsh-syntax-completions";
src = pkgs.zsh-completions;
}
{
name = "powerlevel10k-config";
src = ./p10k-config;
file = "p10k.zsh";
}
];
envExtra = lib.strings.concatStringsSep "\n" [
"BROWSER=firefox"
];
initExtra = lib.strings.concatStringsSep "\n" [
"export KEYTIMEOUT=1"
"bindkey -v '^?' backward-delete-char"
"bindkey '^a' beginning-of-line"
"bindkey '^e' end-of-line"
];
};
};
users.users.alex.shell = pkgs.zsh;
programs.zsh.enable = true;
environment.pathsToLink = [ "/share/zsh" ];
};
} }