helm/modules/shell/zsh.nix

59 lines
1.3 KiB
Nix
Raw Normal View History

2020-01-17 01:22:50 -08:00
# modules/shell/zsh.nix --- ...
2019-08-06 10:56:54 -07:00
2020-03-28 22:48:43 -07:00
{ config, options, pkgs, lib, ... }:
with lib;
2019-08-06 10:56:54 -07:00
{
2020-03-28 22:48:43 -07:00
options.modules.shell.zsh = {
enable = mkOption {
type = types.bool;
default = false;
};
};
2020-01-12 15:17:17 -08:00
2020-03-28 22:48:43 -07:00
config = mkIf config.modules.shell.zsh.enable {
my = {
packages = with pkgs; [
zsh
nix-zsh-completions
bat
exa
fasd
fd
fzf
htop
tldr
tree
];
env.ZDOTDIR = "$XDG_CONFIG_HOME/zsh";
env.ZSH_CACHE = "$XDG_CACHE_HOME/zsh";
2020-01-17 01:22:50 -08:00
2020-03-28 22:48:43 -07:00
alias.exa = "exa --group-directories-first";
alias.l = "exa -1";
alias.ll = "exa -lg";
alias.la = "LC_COLLATE=C exa -la";
alias.sc = "systemctl";
alias.ssc = "sudo systemctl";
# Write it recursively so other modules can write files to it
home.xdg.configFile."zsh" = {
source = <config/zsh>;
recursive = true;
};
2020-01-17 01:22:50 -08:00
};
2019-08-06 10:56:54 -07:00
2020-03-28 22:48:43 -07:00
programs.zsh = {
enable = true;
enableCompletion = true;
# I init completion myself, because enableGlobalCompInit initializes it too
# soon, which means commands initialized later in my config won't get
# completion, and running compinit twice is slow.
enableGlobalCompInit = false;
promptInit = "";
};
2020-01-17 01:22:50 -08:00
2020-03-28 22:48:43 -07:00
system.userActivationScripts.cleanupZgen = ''
rm -fv $XDG_CACHE_HOME/zsh/*
'';
};
2019-08-06 10:56:54 -07:00
}