nix-darwin
nix-darwin copied to clipboard
Error sourcing /etc/static/bashrc after fresh install
chessai@chessais-mbp ~ % source /etc/static/bashrc
/etc/bashrc_Apple_Terminal:173: parse error near `;'
/etc/static/bashrc:21: command not found: shopt
update_terminal_cwd:12: unrecognized modifier `i'
chessai@chessais-mbp ~ % cat /etc/static/bashrc
# /etc/bashrc: DO NOT EDIT -- this file has been generated automatically.
# This file is read for interactive shells.
[ -r "/etc/bashrc_$TERM_PROGRAM" ] && . "/etc/bashrc_$TERM_PROGRAM"
# Only execute this file once per shell.
if [ -n "$__ETC_BASHRC_SOURCED" -o -n "$NOSYSBASHRC" ]; then return; fi
__ETC_BASHRC_SOURCED=1
# Don't execute this file when running in a pure nix-shell.
if test -n "$IN_NIX_SHELL"; then return; fi
if [ -z "$__NIX_DARWIN_SET_ENVIRONMENT_DONE" ]; then
. /nix/store/8rhyrhpxaphb6112pasymkshm1c8cjpi-set-environment
fi
# Return early if not running interactively, but after basic nix setup.
[[ $- != *i* ]] && return
# Make bash check its window size after a process completes
shopt -s checkwinsize
# Read system-wide modifications.
if test -f /etc/bash.local; then
source /etc/bash.local
fi
/etc/static/bashrc:21: command not found: shopt
Did you source it from zsh? This sounds like something you'd see in a non-bash shell.
/etc/static/bashrc:21: command not found: shopt
Did you source it from zsh? This sounds like something you'd see in a non-bash shell.
Yes, but isn't zsh the default macos shell these days?
A bashrc is for bash. Why would the default be relevant?
A bashrc is for bash. Why would the default be relevant?
The installer doesn't consider this; it just tells you to source bashrc regardless of your shell. Given zsh is the default shell, I suggest the installer should either:
- Assume folks are using zsh instead.
- Offer both options (e.g. "source /etc/static/bashrc or source /etc/static/zshrc").
Makes sense. It's been an age since I installed.
The latter seems ideal to me, as one of the rough edges upstream in Nix is already people trying to follow install instructions for some other shell (though I think I've only personally seen fish).
For reference, the relevant line is:
https://github.com/LnL7/nix-darwin/blob/a7492a8c76dcc702d0a65cd820a5f9baa8702684/pkgs/darwin-installer/default.nix#L105
A bashrc is for bash. Why would the default be relevant?
Hah, right. I got confused. Yeah, improving the installer message would be good.