niksos/modules/cli/zsh.nix

87 lines
3.3 KiB
Nix
Raw Normal View History

2023-09-08 16:10:15 +02:00
{
config,
2023-10-13 21:04:24 +02:00
config',
lib,
2023-09-08 16:10:15 +02:00
pkgs,
...
2023-10-13 21:04:24 +02:00
}: with lib; let
cfg = config.myOptions.programs.zsh;
in {
2023-11-25 17:12:09 +01:00
options.myOptions.programs.zsh = {
enable = mkEnableOption "enable zsh";
extraAliases = mkOption {
type = types.attrs;
description = "extra shell aliases";
default = {};
};
profiling = mkOption {
type = types.bool;
description = "enable zsh profiling";
default = false;
};
};
2023-10-13 21:04:24 +02:00
config = mkIf cfg.enable {
home-manager.users.${config'.username} = {
programs.zsh = {
enable = true;
shellAliases = {
cl = "clear";
cp = "cp -ivr";
mv = "mv -iv";
rm = "trash -v";
l = "eza -a";
e = "eza -lha --git";
untar = "tar -xvf";
untargz = "tar -xzf";
mnt = "udisksctl mount -b";
umnt = "udisksctl unmount -b";
v = "nvim";
kys = "shutdown now";
gpl = "curl https://www.gnu.org/licenses/gpl-3.0.txt -o LICENSE";
agpl = "curl https://www.gnu.org/licenses/agpl-3.0.txt -o LICENSE";
g = "git";
n = "nix";
2023-10-13 21:04:24 +02:00
woman = "man";
wget = "wget --hsts-file=\"${config.home-manager.users.${config'.username}.xdg.dataHome}/wget-hsts\"";
2023-11-25 17:12:09 +01:00
} // cfg.extraAliases;
initExtraFirst = mkIf cfg.profiling "zmodload zsh/zprof";
initExtra = mkIf cfg.profiling "zprof";
2023-10-13 21:04:24 +02:00
history = {
path = "${config.home-manager.users.${config'.username}.xdg.dataHome}/zsh/zsh_history";
size = 9999999999;
save = 9999999999;
extended = true;
ignoreSpace = true;
};
enableAutosuggestions = true;
enableCompletion = true;
autocd = false;
dotDir = ".config/zsh";
plugins = [
{
name = "fast-syntax-highlighting";
file = "fast-syntax-highlighting.plugin.zsh";
src = pkgs.fetchFromGitHub {
owner = "zdharma-continuum";
repo = "fast-syntax-highlighting";
rev = "cf318e06a9b7c9f2219d78f41b46fa6e06011fd9";
sha256 = "sha256-RVX9ZSzjBW3LpFs2W86lKI6vtcvDWP6EPxzeTcRZua4=";
};
}
{
name = "zsh-nix-shell";
file = "nix-shell.plugin.zsh";
src = pkgs.fetchFromGitHub {
owner = "chisui";
repo = "zsh-nix-shell";
rev = "v0.7.0";
sha256 = "0za4aiwwrlawnia4f29msk822rj9bgcygw6a8a6iikiwzjjz0g91";
};
}
];
};
2023-09-08 16:10:15 +02:00
};
};
}