@@ -27,12 +27,18 @@ switch $argv[1]
2727 exit 1
2828 end
2929
30− # Build an image with the packages from $config into a temp dir, load
31− # it, then clean up.
30+ # Host login shell (by name): added to the image automatically and used
31+ # as the default shell (what zellij panes etc. spawn), so it needn't be
32+ # listed in container.nix. Falls back to bash.
33+ set -l shell bash
34+ test -n "$SHELL"; and set shell (path basename $SHELL)
35+
36+ # Build an image with the packages from $config (plus the shell) into a
37+ # temp dir, load it, then clean up.
3238 set -l tmp (mktemp -d)
3339 set -l archive $tmp/image.tar.gz
3440 set -lx NIX_CONTAINER_PKGS (path resolve $config)
35− set -l expr "(builtins.getFlake \"$flake\").lib.\${builtins.currentSystem}.copyWith (import (/. + builtins.getEnv \"NIX_CONTAINER_PKGS\"))"
41+ set -l expr "(builtins.getFlake \"$flake\").lib.\${builtins.currentSystem}.copyWithShell \"$shell\" (import (/. + builtins.getEnv \"NIX_CONTAINER_PKGS\"))"
3642 set -l copyer (nix build --impure --no-link --print-out-paths --expr "$expr")
3743 set -l rc $status
3844 if test $rc -eq 0
@@ -62,7 +68,9 @@ switch $argv[1]
6268 # The image only lays down /bin and /etc, so /tmp and /run don't exist;
6369 # without them anything that writes temp files (zellij, build tools, …)
6470 # fails with ENOENT. Mount writable tmpfs at both.
65− container create --name $name --ssh -it -e "HOST_TERM=$TERM" \
71+ # SHELL=/bin/<detected> makes the host shell the default (zellij panes,
72+ # etc.); it overrides the image's baked-in SHELL=/bin/fish fallback.
73+ container create --name $name --ssh -it -e "HOST_TERM=$TERM" -e "SHELL=/bin/$shell" \
6674 --tmpfs /tmp --tmpfs /run --memory 8g --cwd /workspace $mounts $argv $image
6775 case start
6876 # Boot the container detached (its PID1 fish keeps it alive), then attach