docs(nix-style): tighten executable rule prose

This commit is contained in:
2026-10-11 17:33:09 -04:00
parent 65225d0156
commit bb18697a12

View File

@@ -26,27 +26,27 @@ The utility centralizes Nix file-name normalization.
### Rule ### Rule
Use `lib.getExe` when invoking a package's main executable. Use `lib.getExe` for a package's main executable.
Use `lib.getExe'` when invoking a non-main executable from a package. Use `lib.getExe'` for a package's non-main executable.
Do not build executable paths with `"${pkg}/bin/name"` when an executable helper can name the target. Do not build executable paths with `"${pkg}/bin/name"` when an executable helper names the target.
Use `lib.getExe' config.programs.<name>.package "tool"` when a command must follow a configured package option. Use `lib.getExe' config.programs.<name>.package "tool"` when a command follows a configured package option.
### Rationale ### Rationale
Executable helpers use the package output that contains binaries. Executable helpers select the package output that contains binaries.
They also make package ownership explicit. They make package ownership explicit.
`lib.getExe'` avoids accidentally resolving a package's main executable when code needs a different tool. `lib.getExe'` prevents calls to a package's main executable when code needs another tool.
## Prefer NixOS package ownership for commands ## Prefer NixOS package ownership for commands
### Rule ### Rule
Use `pkgs.<name>` for Home Manager tools. Use `pkgs.<name>` for Home Manager tools.
Use `config.programs.<name>.package` when a NixOS module owns the selected package. Use `config.programs.<name>.package` when a NixOS module owns the package selection.
Do not read `config.home-manager.users.<user>.programs.<name>.package` for command paths. Do not read `config.home-manager.users.<user>.programs.<name>.package` for command paths.
### Rationale ### Rationale
Home Manager uses the NixOS package set in this repository. Home Manager uses the NixOS package set in this repository.
Referencing `pkgs.<name>` avoids needless dependency paths through the Home Manager user tree. `pkgs.<name>` avoids dependency paths through the user tree under Home Manager.
Configured NixOS package options preserve the selected package when a module owns the tool. Configured NixOS package options preserve package selection when a module owns the tool.