on master help sign in
Remove the bundled fish prompt config
commite78ed46697af8f5ae4eb6c08ebead11d3b56a4eb authoriko <mail@iko.soy> dateSat 27 Jun 2026, 21:32 (3 months ago) parent240cbd3
3 files changed+10−51
README.md+6−7 c−1 flake.nix+4−43
README.md+6−7
@@ -5,8 +5,8 @@ A Nix flake that builds an **OCI image** (via
55Apple's [`container`](https://github.com/apple/container) CLI on macOS.
66
77It's a plain, single-process image — no NixOS, no systemd — defined in
8−[`flake.nix`](./flake.nix). It runs `fish` by default (with a configured
9−prompt); you choose what it ships via a per-project `container.nix`.
8+[`flake.nix`](./flake.nix). It runs `fish` by default; you choose what it ships
9+via a per-project `container.nix`.
1010
1111## Prerequisites
1212
@@ -62,8 +62,7 @@ nix run github:ilyakooo0/nix-container -- start
6262- `init` builds the OCI archive in a temp dir, loads it into `container`,
6363 deletes the temp file, then (re)creates the container. It mounts the current
6464 directory at `/workspace` (the container's working directory) and your
65− `~/.config` at `/root/.config` (so your host config — including a fish config,
66− if any — takes over the bundled prompt).
65+ `~/.config` at `/root/.config`.
6766- `--ssh` forwards your host SSH agent socket into the container (so `git` over
6867 SSH works with your keys).
6968- Add more mounts by passing them through (mounts can only be set at creation):
@@ -86,9 +85,9 @@ nix run github:ilyakooo0/nix-container -- init
8685
8786## Customize further
8887
89−Fork or clone to change what isn't per-project — `config.cmd`/`env`, the image
90−name, or the fish prompt — in [`flake.nix`](./flake.nix). The flake also exposes
91−build helpers, both taking a `{ pkgs, nur }: [ ... ]` function:
88+Fork or clone to change what isn't per-project — `config.cmd`/`env` or the image
89+name — in [`flake.nix`](./flake.nix). The flake also exposes build helpers, both
90+taking a `{ pkgs, nur }: [ ... ]` function:
9291
9392- `lib.<system>.mkImage` → an OCI image.
9493- `lib.<system>.copyWith` → a skopeo copy app, for building/pushing the image
c−1
@@ -48,7 +48,6 @@ switch $argv[1]
4848 test $rc -eq 0; or exit $rc
4949
5050 # Mount the project at /workspace (the default cwd) and host ~/.config.
51− # (Mounting ~/.config shadows the image's bundled fish prompt config.)
5251 set -l mounts -v "$PWD:/workspace"
5352 test -d $HOME/.config; and set -a mounts -v "$HOME/.config:/root/.config"
5453
flake.nix+4−43
@@ -76,44 +76,9 @@
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).
81− fishConfig = pkgsLinux.writeText "config.fish" ''
82− # No welcome banner.
83− set -g fish_greeting
84−
85− # Define the prompt as a function so fish renders it before every
86− # command; at top level it would run once at startup and be ignored.
87− function fish_prompt
88− set -l nix_shell_info
89− if set -q IN_NIX_SHELL; or set -q IN_NIX_RUN
90− set nix_shell_info ' ❄️'
91− end
92−
93− set -l cwd (prompt_pwd)
94−
95− set -l bookmark_info
96− if jj root 2>/dev/null >/dev/null
97− set -l jj_bookmark (jj log -r 'heads(::@ & bookmarks())' -T 'local_bookmarks ++ "\n"' --no-graph 2>/dev/null | tail -1)
98− if test -n "$jj_bookmark"
99− set bookmark_info ' ' (set_color brmagenta) $jj_bookmark (set_color normal)
100− end
101− end
102−
103− echo -n -s (set_color $fish_color_cwd) $cwd (set_color normal) $bookmark_info ' 🏗️' $nix_shell_info '> '
104− end
105− '';
106−
107− # Lay the config out at the path fish reads.
108− fishRoot = pkgsLinux.runCommand "fish-config-root" { } ''
109− mkdir -p "$out/root/.config/fish"
110− cp ${fishConfig} "$out/root/.config/fish/config.fish"
111− '';
112−
11379 # Build the OCI image from a `{ pkgs, nur }: [ ... ]` package function.
114− # The fish prompt config is always added; the default `cmd` is
115− # /bin/fish, so the package set should include `fish` (warned about
116− # below if missing) or override `config.cmd`.
80+ # The default `cmd` is /bin/fish, so the package set should include
81+ # `fish` (warned about below if missing) or override `config.cmd`.
11782 mkImage =
11883 packages:
11984 let
@@ -133,11 +98,8 @@
13398 # A plain, single-process root filesystem. No NixOS, no systemd.
13499 copyToRoot = pkgsLinux.buildEnv {
135100 name = "root";
136− paths = pkgList ++ [ fishRoot ];
137− pathsToLink = [
138− "/bin"
139− "/root"
140− ];
101+ paths = pkgList;
102+ pathsToLink = [ "/bin" ];
141103 };
142104
143105 initializeNixDatabase = true;
@@ -150,7 +112,6 @@
150112 cmd = [ "/bin/fish" ];
151113 env = [
152114 "PATH=/bin"
153− # fish reads its prompt from $HOME/.config/fish/config.fish.
154115 "HOME=/root"
155116 ];
156117 };