@@ -72,21 +72,22 @@
7272 # Host package set, for the wrapper app below.
7373 pkgsHost = nixpkgs.legacyPackages.${system};
7474
75− # Name/tag baked into the image's OCI config.
75+ # Default image name (for `copyWith`); `c init` passes a per-directory
76+ # name (`nix-container-<dir>`) to `copyWithShell` instead.
7677 imageName = "nix-container";
7778 imageTag = "latest";
7879
79− # Build the OCI image from a `{ pkgs, nur }: [ ... ]` package function,
80− # for the named shell. The shell is the image's `cmd` (a PID1 that just
81− # holds the container open — `c start` execs the real session into it)
82− # and the default `$SHELL`; it's added automatically, so `container.nix`
80+ # Build the OCI image (named `name`) from a `{ pkgs, nur }: [ ... ]`
81+ # package function, for the named shell. The image's `cmd` is zellij
82+ # (the session `c start` attaches to); the shell is the default `$SHELL`
83+ # (what zellij panes spawn) and is added automatically, so `container.nix`
8384 # lists only your extras. Nix (+ CA certs) and the ncurses terminfo
8485 # database are always shipped too. Nothing here is fish-specific: the
85− # TERM fixup now happens host-side in `c` (passed via `-e TERM`).
86+ # TERM fixup happens host-side in `c` (passed via `-e TERM` at create).
8687 mkImage =
87− shell: packages:
88+ name: shell: packages:
8889 n2c.buildImage {
89− name = imageName;
90+ inherit name;
9091 tag = imageTag;
9192 inherit arch;
9293
@@ -132,10 +133,10 @@
132133
133134 config = {
134135 # `cmd` (not `entrypoint`): the default command, *replaced* by any
135− # command passed to `container run/create`. It's the detected
136− # shell — as PID1 it just holds the container open; `c start`
137− # execs the real interactive session (zellij) into it.
138− cmd = [ "/bin/${shell}" ];
136+ # command passed to `container run/create`. It's zellij — the
137+ # session `c start` attaches to via `container start -ai`; exiting
138+ # it (PID1) stops the container.
139+ cmd = [ "/bin/zellij" ];
139140 env = [
140141 "PATH=/bin"
141142 "HOME=/root"
@@ -182,13 +183,14 @@
182183 lib = {
183184 inherit mkImage;
184185 # Build the image's `copyTo` script (a skopeo-copy wrapper) from a
185− # `{ pkgs, nur }: [ ... ]` function. Defaults the shell (cmd + $SHELL)
186− # to bash; use `copyWithShell` to pick another.
187− copyWith = packages: (mkImage "bash" packages).copyTo;
188− # Like `copyWith`, but for the named shell — `c init` passes the host
189− # login shell, which is added to the image and used as cmd + $SHELL
190− # without being listed in `container.nix`.
191− copyWithShell = shell: packages: (mkImage shell packages).copyTo;
186+ # `{ pkgs, nur }: [ ... ]` function, named `imageName`. Defaults the
187+ # shell (cmd + $SHELL) to bash; use `copyWithShell` to pick another.
188+ copyWith = packages: (mkImage imageName "bash" packages).copyTo;
189+ # Like `copyWith`, but for the given image `name` and shell — `c init`
190+ # passes `nix-container-<dir>` and the host login shell, which is added
191+ # to the image and used as cmd + $SHELL without being listed in
192+ # `container.nix`.
193+ copyWithShell = name: shell: packages: (mkImage name shell packages).copyTo;
192194 };
193195 }
194196 );