@@ -27,12 +27,17 @@ switch $argv[1]
2727 exit 1
2828 end
2929
30− # Build an image with exactly the packages from $config, into a temp
31− # dir, load it, then clean up.
30+ # Host login shell (by name): run as the container cmd and added to the
31+ # image automatically, so it needn't be listed in container.nix.
32+ set -l shell fish
33+ test -n "$SHELL"; and set shell (path basename $SHELL)
34+
35+ # Build an image with the packages from $config (plus the shell) into a
36+ # temp dir, load it, then clean up.
3237 set -l tmp (mktemp -d)
3338 set -l archive $tmp/image.tar.gz
3439 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\"))"
40+ set -l expr "(builtins.getFlake \"$flake\").lib.\${builtins.currentSystem}.copyWithShell \"$shell\" (import (/. + builtins.getEnv \"NIX_CONTAINER_PKGS\"))"
3641 set -l copyer (nix build --impure --no-link --print-out-paths --expr "$expr")
3742 set -l rc $status
3843 if test $rc -eq 0
@@ -51,11 +56,6 @@ switch $argv[1]
5156 set -l mounts -v "$PWD:/workspace"
5257 test -d $HOME/.config; and set -a mounts -v "$HOME/.config:/root/.config"
5358
54− # Run the host's login shell (by name) instead of the image's default
55− # cmd. The shell must be in the package set.
56− set -l shell fish
57− test -n "$SHELL"; and set shell (path basename $SHELL)
58−
5959 # Replace any existing container of the same name.
6060 container rm --force $name 2>/dev/null
6161 container create --name $name --ssh -it --cwd /workspace $mounts $argv $image /bin/$shell