config-perso/kat/users/zsh.nix

91 lines
2.3 KiB
Nix

{
system =
{
config,
pkgs,
lib,
...
}:
with lib;
mkMerge [
{
users.users = mapAttrs (
_: val:
mkIf val.kat.zsh {
shell = pkgs.zsh;
}
) config.home-manager.users;
}
(mkIf (any (val: val.kat.zsh) (attrValues config.home-manager.users)) {
programs.zsh.enable = true;
})
];
user =
{
config,
pkgs,
lib,
...
}:
with lib;
{
options.kat.zsh = mkEnableOption "zsh configuration" // {
default = true;
};
config = mkIf config.kat.zsh {
programs = {
zsh = {
enable = true;
oh-my-zsh = {
enable = true;
plugins = [ "git" ];
};
plugins = [
{
name = "zsh-nix-shell";
file = "nix-shell.plugin.zsh";
src = pkgs.fetchFromGitHub {
owner = "chisui";
repo = "zsh-nix-shell";
rev = "v0.8.0";
sha256 = "1lzrn0n4fxfcgg65v0qhnj7wnybybqzs4adz7xsrkgmcsr0ii8b7";
};
}
{
name = "zsh-autosuggestion";
file = "zsh-autosuggestions.zsh";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-autosuggestions";
rev = "v0.7.0";
sha256 = "1g3pij5qn2j7v7jjac2a63lxd97mcsgw6xq6k5p7835q9fjiid98";
};
}
{
name = "zsh-syntax-highlighting";
file = "zsh-syntax-highlighting.zsh";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-syntax-highlighting";
rev = "0.8.0";
sha256 = "1yl8zdip1z9inp280sfa5byjbf2vqh2iazsycar987khjsi5d5w8";
};
}
];
};
starship = {
enable = true;
enableZshIntegration = true;
settings.battery.disabled = true;
};
direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
};
};
};
};
}