Skip to content

fix: programs from split outputs & better command-not-found proposals - #49

Merged
raphaelcoeffic merged 3 commits into
mainfrom
fix/issue-48-split-outputs
Nov 28, 2026
Merged

raphaelcoeffic merged 3 commits into
mainfrom
fix/issue-48-split-outputs

Conversation

@raphaelcoeffic

@raphaelcoeffic raphaelcoeffic commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

Fixes #48.

Split outputs missing from the base image

findutils ships locate/updatedb in a separate locate output, and util-linux ships mount/umount in a mount output. buildEnv only links default outputs, so these were missing although their packages are built in. Both outputs are now part of the base packages (this changes the base image hash, so existing installs rebuild on upgrade).

The program index maps programs to packages, not outputs, so the command-not-found handler offered to install the already-installed package, which then failed with "already installed". When any package providing the command is installed, the handler now explains the program lives in another output instead of prompting. This covers the remaining cases (swapon, nologin, lastlog2, routel).

Renamed fltk packages back in the program index

nixos-26.05 renamed fltk/fltk14 to fltk_1_4, fltk_1_4-minimal and fltk-minimal, which slipped past the exclusion list: ~140 demo programs with generic names were back in the index (tree offered fltk_1_4). Any fltk* package is now excluded.

Ranking of proposed packages

The handler proposed the first candidate alphabetically. It now prefers, in order: the package named after the command, packages whose name starts with it, other top-level packages, and last nested attributes and multi-call bundles (toybox, u-root-cmds, ...).

command before after
wget toybox wget
python3 graalvmPackages.graalpy python311
node elmPackages.nodejs nodejs-slim
traceroute inetutils traceroute
tree fltk_1_4 tree

Testing

  • cargo fmt --check, cargo clippy --all-targets, cargo test (new unit tests for the ranking)
  • Built a buildEnv from nixos-26.05 with the new attributes: locate, updatedb, mount, umount are linked
  • Ran pkg _CmdNotFound <cmd> under a pty for ~50 commands against the regenerated index
  • Not tested end to end inside a dive shell with a rebuilt base image

findutils ships locate & updatedb in a separate `locate` output, and
util-linux ships mount & umount in a `mount` output: buildEnv only links
the default outputs, so these were missing although their packages are
built in. Add both outputs to the base packages.

The program index maps programs to packages, not to outputs: the
command-not-found handler offered to install the package already there,
which then failed with "already installed". When any package providing
the command is installed, explain the program lives in another output
instead of prompting.

Fixes #48
nixos-26.05 renamed fltk & fltk14 to fltk_1_4, fltk_1_4-minimal and
fltk-minimal, so their ~140 demo programs with generic names were back
in the index: `tree` offered to install fltk_1_4. Exclude any fltk*
package.
The command-not-found handler proposed the first package providing the
command in alphabetical order: wget offered toybox, python3 offered
graalvmPackages.graalpy. Prefer the package named after the command,
then packages whose name starts with it, and propose nested attributes
and multi-call bundles (toybox, u-root-cmds, ...) last.
@raphaelcoeffic
raphaelcoeffic force-pushed the fix/issue-48-split-outputs branch from 4452cc6 to 1637f4b Compare November 28, 2026 07:05
@raphaelcoeffic
raphaelcoeffic merged commit 75cfed1 into main Nov 28, 2026
2 checks passed
@raphaelcoeffic
raphaelcoeffic deleted the fix/issue-48-split-outputs branch November 28, 2026 07:10
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.

findutils prompted for install when trying to use locate

1 participant