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