Skip to content

fix(image): add /usr/bin/env to the Nix-built image - #730

Merged
c-vigo merged 2 commits into
feature/625-nix-claude-migrationfrom
bugfix/727-usr-bin-env
Jun 29, 2026
Merged

c-vigo merged 2 commits into
feature/625-nix-claude-migrationfrom
bugfix/727-usr-bin-env

Conversation

@c-vigo

@c-vigo c-vigo commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

The Nix-built image (flake.nix packages.devcontainerImage, dockerTools.buildLayeredImage) had no /usr/bin/env — /usr/bin did not exist at all. env lived only at /bin/env. The universal #!/usr/bin/env <interp> shebang therefore failed inside the image:

sh: .../node_modules/.bin/tsc: /usr/bin/env: bad interpreter: No such file or directory

This broke essentially every Node/Python/Ruby CLI for image-mode consumers.

Fix

Added pkgs.dockerTools.usrBinEnv to the image package set (imageTools), right next to the existing dockerTools.fakeNss shim. usrBinEnv is the idiomatic nixpkgs FHS shim that symlinks /usr/bin/env to coreutils env — the minimal piece an FHS base distro would have supplied. Minimal, one-line diff consistent with how the flake already assembles its FHS shims.

Verification

Direct check in the rebuilt :dev image:

$ podman run --rm ghcr.io/vig-os/devcontainer:dev bash -lc \
    'ls -l /usr/bin/env && printf "#!/usr/bin/env node\nconsole.log(1)\n" > /tmp/t && chmod +x /tmp/t && /tmp/t'
lrwxrwxrwx 1 root root 66 Jan  1  1980 /usr/bin/env -> /nix/store/...-coreutils-9.11/bin/env
1

Both a #!/usr/bin/env node and a #!/usr/bin/env bash shebang script now execute.

Tests (TDD)

Added TestFhsShims to tests/test_image.py:

  • test_usr_bin_env_exists — asserts /usr/bin/env exists.
  • test_usr_bin_env_shebang_runs — asserts a #!/usr/bin/env bash script runs via /usr/bin/env.

Both committed as a failing test first (RED, confirmed 126 == 0 / bad interpreter), then the fix. Full image suite after the fix: 66 passed.

Closes #727

@c-vigo
c-vigo merged commit ef1309d into feature/625-nix-claude-migration Jun 29, 2026
2 checks passed
@c-vigo
c-vigo deleted the bugfix/727-usr-bin-env branch June 29, 2026 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant