home/zsh: move compinit to hm activation

This commit is contained in:
Oystein Kristoffer Tveit 2024-06-30 17:29:26 +02:00
parent 49eec1ed0d
commit dc9adaae31
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
1 changed files with 17 additions and 4 deletions

View File

@ -1,5 +1,21 @@
{ pkgs, lib, config, ... }:
let
cfg = config.programs.zsh;
in
{
home.file."${cfg.dotDir}/.zshrc".onChange = ''
${lib.getExe (pkgs.writeTextFile {
name = "zsh-compinit-oneshot.zsh";
executable = true;
destination = "/bin/zsh-compinit-oneshot.zsh";
text = ''
#!${lib.getExe cfg.package}
autoload -Uz compinit && compinit -C -d "${config.xdg.cacheHome}/zsh/zcompdump-$ZSH_VERSION"
'';
})}
'';
programs.zsh = {
enable = true;
@ -12,10 +28,7 @@
fpath+=(${pkgs.zsh-completions}/share/zsh/site-functions)
'';
# TODO: Regenerate zcompdump with a systemd timer
completionInit = ''
autoload -Uz compinit && compinit -C -d "${config.xdg.cacheHome}/zsh/zcompdump-$ZSH_VERSION"
'';
completionInit = "";
history = {
extended = true;