diff options
| author | 2026-05-22 10:41:22 +0100 | |
|---|---|---|
| committer | 2026-05-22 10:41:22 +0100 | |
| commit | 0c292694f37f107629b5287f96ebb945ff764b68 (patch) | |
| tree | 1b860f68ccc53790b5f4cd0bb2cc5256fa5ab318 | |
| parent | dff883ec04c62dc4a111597aace1ce5972b7dc01 (diff) | |
| download | dotfiles-0c292694f37f107629b5287f96ebb945ff764b68.tar.gz dotfiles-0c292694f37f107629b5287f96ebb945ff764b68.tar.bz2 dotfiles-0c292694f37f107629b5287f96ebb945ff764b68.zip | |
fix(just): chsh to nix-managed zsh after nix-switch
zsh now lives in nix/common.nix instead of meta/base.txt. Removing the
pacman zsh package leaves /etc/passwd dangling at /usr/bin/zsh, so new
login terminals die with 'shell not found'.
Mirror the chsh logic from nix/bootstrap.sh (which only runs on the VM
during first-time provisioning) into the nix-switch recipe so every
`just sync` / `just init` re-asserts the login shell — and the
host gets the same treatment as the VM.
Idempotent: skips when the shell already matches, skips when
~/.nix-profile/bin/zsh is missing (pre-bootstrap state).
| -rw-r--r-- | justfile | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -42,6 +42,20 @@ nix-switch: nix --extra-experimental-features 'nix-command flakes' \ run home-manager/master -- \ switch --impure --flake "{{ justfile_directory() }}/nix#${profile}" -b backup + # Ensure login shell points at the home-manager-managed zsh. Without + # this, removing zsh from meta/base.txt (now provisioned via nix) + # leaves /etc/passwd dangling at /usr/bin/zsh and new terminals die. + # Idempotent: only acts when current login shell differs. + NIX_ZSH="$HOME/.nix-profile/bin/zsh" + if [ -x "$NIX_ZSH" ]; then + if ! grep -qxF "$NIX_ZSH" /etc/shells 2>/dev/null; then + echo "$NIX_ZSH" | sudo tee -a /etc/shells >/dev/null + fi + current_shell="$(getent passwd "$USER" | cut -d: -f7)" + if [ "$current_shell" != "$NIX_ZSH" ]; then + sudo chsh -s "$NIX_ZSH" "$USER" + fi + fi # ═══════════════════════════════════════════════════════════════════ # Updates |
