docs(nix-style): add package command rules
This commit is contained in:
@@ -21,3 +21,32 @@ Do not call `lib.removeSuffix ".nix"` outside the utility definition.
|
|||||||
### Rationale
|
### Rationale
|
||||||
|
|
||||||
The utility centralizes Nix file-name normalization.
|
The utility centralizes Nix file-name normalization.
|
||||||
|
|
||||||
|
## Use executable helpers for package commands
|
||||||
|
|
||||||
|
### Rule
|
||||||
|
|
||||||
|
Use `lib.getExe` for a package's main executable.
|
||||||
|
Use `lib.getExe'` for a package's non-main executable.
|
||||||
|
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 follows a configured package option.
|
||||||
|
|
||||||
|
### Rationale
|
||||||
|
|
||||||
|
Executable helpers select the package output that contains binaries.
|
||||||
|
They make package ownership explicit.
|
||||||
|
`lib.getExe'` prevents calls to a package's main executable when code needs another tool.
|
||||||
|
|
||||||
|
## Prefer NixOS package ownership for commands
|
||||||
|
|
||||||
|
### Rule
|
||||||
|
|
||||||
|
Use `pkgs.<name>` for Home Manager tools.
|
||||||
|
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.
|
||||||
|
|
||||||
|
### Rationale
|
||||||
|
|
||||||
|
Home Manager uses the NixOS package set in this repository.
|
||||||
|
`pkgs.<name>` avoids dependency paths through the user tree under Home Manager.
|
||||||
|
Configured NixOS package options preserve package selection when a module owns the tool.
|
||||||
|
|||||||
Reference in New Issue
Block a user