@@ -76,10 +76,11 @@
7676 imageName = "nix-container";
7777 imageTag = "latest";
7878
79− # Fish prompt config, installed at /root/.config/fish/config.fish
80− # (fish reads $HOME/.config/fish). Built on the host arch — it's just a
81− # text file, so no Linux builder is needed.
82− fishConfig = pkgsHost.writeText "config.fish" ''
79+ # Fish prompt config. Installed at /etc/fish/prompt.fish and loaded via
80+ # `fish --no-config --init-command` (see `cmd` below), NOT from
81+ # $HOME/.config/fish — so the `~/.config` mount can't shadow it. Built
82+ # on the host arch (just a text file), so no Linux builder is needed.
83+ fishConfig = pkgsHost.writeText "prompt.fish" ''
8384 # No welcome banner.
8485 set -g fish_greeting
8586
@@ -105,10 +106,10 @@
105106 end
106107 '';
107108
108− # Lay the config out at the path fish reads.
109− fishRoot = pkgsHost.runCommand "fish-config-root" { } ''
110− mkdir -p "$out/root/.config/fish"
111− cp ${fishConfig} "$out/root/.config/fish/config.fish"
109+ # Lay the prompt out at the path the cmd sources.
110+ fishRoot = pkgsHost.runCommand "fish-prompt" { } ''
111+ mkdir -p "$out/etc/fish"
112+ cp ${fishConfig} "$out/etc/fish/prompt.fish"
112113 '';
113114
114115 # Build the OCI image from a `{ pkgs, nur }: [ ... ]` package function.
@@ -144,7 +145,7 @@
144145 ];
145146 pathsToLink = [
146147 "/bin"
147− "/root"
148+ "/etc/fish"
148149 "/etc/ssl"
149150 ];
150151 };
@@ -152,11 +153,16 @@
152153 initializeNixDatabase = true;
153154
154155 config = {
155− # `cmd` (not `entrypoint`): it's the default command and is
156− # *replaced* by `container run … -- <cmd>`. An entrypoint would be
157− # prepended instead, so `run … -- /bin/sh` would become
158− # `/bin/bash /bin/sh` and fail with "cannot execute binary file".
159− cmd = [ "/bin/fish" ];
156+ # `cmd` (not `entrypoint`): the default command, *replaced* by any
157+ # command passed to `container run/create`. `--no-config` skips
158+ # $HOME/.config/fish (so a mounted ~/.config can't override the
159+ # prompt); `--init-command` loads the bundled prompt instead.
160+ cmd = [
161+ "/bin/fish"
162+ "--no-config"
163+ "--init-command"
164+ "source /etc/fish/prompt.fish"
165+ ];
160166 env = [
161167 "PATH=/bin"
162168 "HOME=/root"