File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 2121
2222 home . sessionVariables = userConfig . env ;
2323
24+ # Set zsh as default shell on activation
25+ home . activation . make-zsh-default-shell = lib . hm . dag . entryAfter [ "writeBoundary" ] ''
26+ # if zsh is not the current shell
27+ PATH="/usr/bin:/bin:$PATH"
28+ ZSH_PATH="/home/${ user } /.nix-profile/bin/zsh"
29+ if [[ $(getent passwd ${ user } ) != *"$ZSH_PATH" ]]; then
30+ echo "setting zsh as default shell (using chsh). password might be necessary."
31+ if grep -q $ZSH_PATH /etc/shells; then
32+ echo "adding zsh to /etc/shells"
33+ run echo "$ZSH_PATH" | sudo tee -a /etc/shells
34+ fi
35+ echo "running chsh to make zsh the default shell"
36+ run chsh -s $ZSH_PATH ${ user }
37+ echo "zsh is now set as default shell !"
38+ fi
39+ '' ;
40+
2441 # Let Home Manager install and manage itself.
2542 programs . home-manager . enable = true ;
2643
You can’t perform that action at this time.
0 commit comments