@@ -112,43 +112,50 @@
113 # Build the OCI image from a `{ pkgs, nur }: [ ... ]` package function.
113 # Build the OCI image from a `{ pkgs, nur }: [ ... ]` package function.
114 # The fish prompt config is always added; the default `cmd` is
114 # The fish prompt config is always added; the default `cmd` is
115− # /bin/fish, so a custom package set should include `fish` (or change
115+ # /bin/fish, so the package set should include `fish` (warned about
116− # `config.cmd`).
116+ # below if missing) or override `config.cmd`.
117 mkImage =
117 mkImage =
118 packages:
118 packages:
119− n2c.buildImage {
119+ let
124− # A plain, single-process root filesystem. No NixOS, no systemd.
125− copyToRoot = pkgsLinux.buildEnv {
127− paths = packages {
120+ pkgList = packages {
128− pkgs = pkgsLinux;
121+ pkgs = pkgsLinux;
129− nur = nurPkgs;
122+ nur = nurPkgs;
125+ pkgsLinux.lib.warnIf (!builtins.any (p: (p.pname or "") == "fish") pkgList)
126+ "nix-container: config.cmd is /bin/fish but the package set has no `fish` — the container will fail to start unless something provides /bin/fish (or change config.cmd)."
133+ # A plain, single-process root filesystem. No NixOS, no systemd.
134+ copyToRoot = pkgsLinux.buildEnv {
136+ paths = pkgList ++ [ fishRoot ];
137− initializeNixDatabase = true;
143+ initializeNixDatabase = true;
139− config = {
145+ config = {
140− # `cmd` (not `entrypoint`): it's the default command and is
146+ # `cmd` (not `entrypoint`): it's the default command and is
141− # *replaced* by `container run … -- <cmd>`. An entrypoint would
147+ # *replaced* by `container run … -- <cmd>`. An entrypoint would
142− # be prepended instead, so `run … -- /bin/sh` would become
148+ # be prepended instead, so `run … -- /bin/sh` would become
143− # `/bin/bash /bin/sh` and fail with "cannot execute binary file".
149+ # `/bin/bash /bin/sh` and fail with "cannot execute binary file".
144− cmd = [ "/bin/fish" ];
150+ cmd = [ "/bin/fish" ];
146− "PATH=/bin"
152+ "PATH=/bin"
147− # fish reads its prompt from $HOME/.config/fish/config.fish.
153+ # fish reads its prompt from $HOME/.config/fish/config.fish.
148− "HOME=/root"
154+ "HOME=/root"
153 # `nix run . -- init|start` runs the bundled `c` manager script. Its
160 # `nix run . -- init|start` runs the bundled `c` manager script. Its
154 # `init` builds the image from the project's `container.nix` (via
161 # `init` builds the image from the project's `container.nix` (via