feat: add flake develop zsh hook
This commit is contained in:
parent
cf44bee47d
commit
684d79ee79
1 changed files with 17 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
|||
{ config, ... }: {
|
||||
{ config, pkgs, ... }: {
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
|
|
@ -12,10 +12,26 @@
|
|||
"git"
|
||||
];
|
||||
};
|
||||
|
||||
history = {
|
||||
path = "${config.xdg.dataHome}/zsh/histfile";
|
||||
size = 10000;
|
||||
save = 10000;
|
||||
};
|
||||
|
||||
initExtra = ''
|
||||
nix_dev_env() {
|
||||
FLAKE="$PWD/flake.nix"
|
||||
[[ -z "$CURRENT_FLAKE_ENV" ]] && \
|
||||
[[ -f $FLAKE ]] && \
|
||||
ZSH_PREFIX="$ZSH_PREFIX(flake)" \
|
||||
CURRENT_FLAKE_ENV=$FLAKE \
|
||||
nix develop -c $SHELL 2> /dev/null
|
||||
}
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook chpwd nix_dev_env
|
||||
|
||||
export PS1="$ZSH_PREFIX$PS1"
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue