docs(nix-style): prefer NixOS package ownership

This commit is contained in:
2026-10-11 17:30:53 -04:00
parent 8a739e92be
commit 81a0e0ab76

View File

@@ -36,3 +36,18 @@ Use `lib.getExe' config.programs.<name>.package "tool"` when a command must foll
Executable helpers use the package output that contains binaries.
They also make package ownership explicit.
`lib.getExe'` avoids accidentally resolving a package's main executable when code needs a different tool.
## Prefer NixOS package ownership for commands
### Rule
Use `pkgs.<name>` for Home Manager tools when Home Manager uses global NixOS packages.
Use `config.programs.<name>.package` when a NixOS module owns the selected package.
Do not read `config.home-manager.users.<user>.programs.<name>.package` for command paths.
Use that Home Manager package option only when Home Manager intentionally selects a different package.
### Rationale
Most Home Manager modules in this repository share the NixOS package set.
Referencing `pkgs.<name>` avoids needless dependency paths through the Home Manager user tree.
Configured NixOS package options preserve the selected package when a module owns the tool.