on 69bd573 help sign in
README.md+3−3
since splitsnapshots
unifiedsplit
@@ -6,7 +6,7 @@ Apple's [`container`](https://github.com/apple/container) CLI on macOS.
6
6
7It's a plain, single-process image — no NixOS, no systemd — defined in
7It's a plain, single-process image — no NixOS, no systemd — defined in
8[`flake.nix`](./flake.nix). `c start` drops you into a
8[`flake.nix`](./flake.nix). `c start` drops you into a
9−[`herdr`](https://herdr.dev) session whose panes use your host login shell
9+[`zellij`](https://zellij.dev) session whose panes use your host login shell
10(detected and bundled by `c init`). You choose what else it ships via a
10(detected and bundled by `c init`). You choose what else it ships via a
11per-project `container.nix`.
11per-project `container.nix`.
12
12
@@ -49,7 +49,7 @@ nixpkgs) and an optional `mounts` list. It is **required**; there is no default.
49```
49```
50
50
51Your **host login shell** (detected by `c init`, bash fallback), **coreutils**,
51Your **host login shell** (detected by `c init`, bash fallback), **coreutils**,
52−[**herdr**](https://herdr.dev) (the session `c start` launches), **Nix** itself
52+[**zellij**](https://zellij.dev) (the session `c start` launches), **Nix** itself
53(with CA certs and `nix-command`/`flakes` enabled, single-user), and the ncurses
53(with CA certs and `nix-command`/`flakes` enabled, single-user), and the ncurses
54**terminfo** database are always included — no need to list them.
54**terminfo** database are always included — no need to list them.
55
55
@@ -68,7 +68,7 @@ that holds a `container.nix`; the container is named after that directory.
68# build the image, load it, and create the container (named after $PWD):
68# build the image, load it, and create the container (named after $PWD):
69nix run github:ilyakooo0/nix-container -- init
69nix run github:ilyakooo0/nix-container -- init
70
70
71−# start it and attach — drops you into a herdr session:
71+# start it and attach — drops you into a zellij session:
72nix run github:ilyakooo0/nix-container -- start
72nix run github:ilyakooo0/nix-container -- start
73```
73```
74
74
c+10−12
@@ -28,7 +28,7 @@ switch $argv[1]
28 end
28 end
29
29
30 # Host login shell (by name): added to the image automatically and baked
30 # Host login shell (by name): added to the image automatically and baked
31− # in as the cmd + default $SHELL (what herdr panes etc. spawn), so it
31+ # in as the cmd + default $SHELL (what zellij panes etc. spawn), so it
32 # needn't be listed in container.nix. Falls back to bash.
32 # needn't be listed in container.nix. Falls back to bash.
33 set -l shell bash
33 set -l shell bash
34 test -n "$SHELL"; and set shell (path basename $SHELL)
34 test -n "$SHELL"; and set shell (path basename $SHELL)
@@ -37,8 +37,8 @@ switch $argv[1]
37 # temp dir, load it, then clean up.
37 # temp dir, load it, then clean up.
38 set -l tmp (mktemp -d)
38 set -l tmp (mktemp -d)
39 set -l archive $tmp/image.tar.gz
39 set -l archive $tmp/image.tar.gz
40− set -lx NIX_CONTAINER_CONFIG (path resolve $config)
40+ set -lx NIX_CONTAINER_PKGS (path resolve $config)
41− set -l expr "(builtins.getFlake \"$flake\").lib.\${builtins.currentSystem}.copyWithShell \"nix-container-$name\" \"$shell\" (import (/. + builtins.getEnv \"NIX_CONTAINER_CONFIG\")).packages"
41+ set -l expr "(builtins.getFlake \"$flake\").lib.\${builtins.currentSystem}.copyWithShell \"nix-container-$name\" \"$shell\" (import (/. + builtins.getEnv \"NIX_CONTAINER_PKGS\")).packages"
42 set -l copyer (nix build --impure --no-link --print-out-paths --expr "$expr")
42 set -l copyer (nix build --impure --no-link --print-out-paths --expr "$expr")
43 set -l rc $status
43 set -l rc $status
44 if test $rc -eq 0
44 if test $rc -eq 0
@@ -57,7 +57,7 @@ switch $argv[1]
57 # mounts from the config (`mounts = [ "host:container" … ]`). A leading
57 # mounts from the config (`mounts = [ "host:container" … ]`). A leading
58 # ~/ in the host path expands to $HOME (nix leaves it literal).
58 # ~/ in the host path expands to $HOME (nix leaves it literal).
59 set -l mounts -v "$PWD:/workspace"
59 set -l mounts -v "$PWD:/workspace"
60− for m in (nix eval --impure --raw --expr "builtins.concatStringsSep \"\n\" ((import (/. + builtins.getEnv \"NIX_CONTAINER_CONFIG\")).mounts or [])")
60+ for m in (nix eval --impure --raw --expr "builtins.concatStringsSep \"\n\" ((import (/. + builtins.getEnv \"NIX_CONTAINER_PKGS\")).mounts or [])")
61 set -a mounts -v (string replace -r '^~/' "$HOME/" -- $m)
61 set -a mounts -v (string replace -r '^~/' "$HOME/" -- $m)
62 end
62 end
63
63
@@ -73,20 +73,18 @@ switch $argv[1]
73 set term $TERM
73 set term $TERM
74 end
74 end
75
75
76− # Replace any existing container of the same name, then create it running
76+ # Replace any existing container of the same name. The image's cmd is
77− # herdr in a session named after the project (`<dir>-container`). This
77+ # zellij (`c start` attaches to it), so no command is passed here.
78− # overrides the image's default plain-herdr cmd; `c start` attaches to it.
79 container rm --force $name 2>/dev/null
78 container rm --force $name 2>/dev/null
80 # The image only lays down /bin and /etc, so /tmp and /run don't exist;
79 # The image only lays down /bin and /etc, so /tmp and /run don't exist;
81− # without them anything that writes temp files (herdr, build tools, …)
80+ # without them anything that writes temp files (zellij, build tools, …)
82 # fails with ENOENT. Mount writable tmpfs at both.
81 # fails with ENOENT. Mount writable tmpfs at both.
83 container create --name $name --ssh -it -e "TERM=$term" \
82 container create --name $name --ssh -it -e "TERM=$term" \
84− --tmpfs /tmp --tmpfs /run --memory 8g --cwd /workspace $mounts $argv \
83+ --tmpfs /tmp --tmpfs /run --memory 8g --cwd /workspace $mounts $argv $image
85− $image /bin/herdr session attach "$name-container"
86 case start
84 case start
87− # Start the container and attach to its cmd (herdr). TERM was baked into
85+ # Start the container and attach to its cmd (zellij). TERM was baked into
88 # the container env at create time (`-e TERM`), which survives this path.
86 # the container env at create time (`-e TERM`), which survives this path.
89− # Exiting herdr (PID1) stops the container; `c start` boots it again.
87+ # Exiting zellij (PID1) stops the container; `c start` boots it again.
90 container start -ai $name
88 container start -ai $name
91 case '*'
89 case '*'
92 echo "usage: c init [-c FILE] [create args] | start" >&2
90 echo "usage: c init [-c FILE] [create args] | start" >&2
flake.nix+8−9
@@ -78,9 +78,9 @@
78 imageTag = "latest";
78 imageTag = "latest";
79
79
80 # Build the OCI image (named `name`) from a `{ pkgs, nur }: [ ... ]`
80 # Build the OCI image (named `name`) from a `{ pkgs, nur }: [ ... ]`
81− # package function, for the named shell. The image's `cmd` is herdr
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`
82 # (the session `c start` attaches to); the shell is the default `$SHELL`
83− # (what herdr panes spawn) and is added automatically, so `container.nix`
83+ # (what zellij panes spawn) and is added automatically, so `container.nix`
84 # lists only your extras. Nix (+ CA certs) and the ncurses terminfo
84 # lists only your extras. Nix (+ CA certs) and the ncurses terminfo
85 # database are always shipped too. Nothing here is fish-specific: the
85 # database are always shipped too. Nothing here is fish-specific: the
86 # TERM fixup happens host-side in `c` (passed via `-e TERM` at create).
86 # TERM fixup happens host-side in `c` (passed via `-e TERM` at create).
@@ -119,7 +119,7 @@
119 # entry for whatever TERM `c` passes in and render correctly.
119 # entry for whatever TERM `c` passes in and render correctly.
120 pkgsLinux.ncurses
120 pkgsLinux.ncurses
121 # The session `c start` always launches.
121 # The session `c start` always launches.
122− pkgsLinux.herdr
122+ pkgsLinux.zellij
123 ];
123 ];
124 # Link all of /etc so the above files (nsswitch.conf, protocols,
124 # Link all of /etc so the above files (nsswitch.conf, protocols,
125 # services, passwd, group, ssl certs) are present.
125 # services, passwd, group, ssl certs) are present.
@@ -133,15 +133,14 @@
133
133
134 config = {
134 config = {
135 # `cmd` (not `entrypoint`): the default command, *replaced* by any
135 # `cmd` (not `entrypoint`): the default command, *replaced* by any
136− # command passed to `container run/create`. Plain herdr here;
136+ # command passed to `container run/create`. It's zellij — the
137− # `c init` overrides it with `herdr session attach <dir>-container` so
138− # the session is named per project. `c start` attaches via
137+ # session `c start` attaches to via `container start -ai`; exiting
139− # `container start -ai`; exiting herdr (PID1) stops the container.
138+ # it (PID1) stops the container.
140− cmd = [ "/bin/herdr" ];
139+ cmd = [ "/bin/zellij" ];
141 env = [
140 env = [
142 "PATH=/bin"
141 "PATH=/bin"
143 "HOME=/root"
142 "HOME=/root"
144− # Default shell for tools that spawn one (herdr panes, etc.).
143+ # Default shell for tools that spawn one (zellij panes, etc.).
145 "SHELL=/bin/${shell}"
144 "SHELL=/bin/${shell}"
146 # Marker so shells/scripts can detect they're in here.
145 # Marker so shells/scripts can detect they're in here.
147 "NIX_CONTAINER=1"
146 "NIX_CONTAINER=1"