Merge pull request #281490 from eclairevoyant/docs-mainprogram

pkgs/README.md: clarify guidelines for `meta.mainProgram`
This commit is contained in:
Silvan Mosberger 2024-02-10 03:01:04 +01:00 committed by GitHub
commit 12d7391dac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -384,7 +384,13 @@ All versions of a package _must_ be included in `all-packages.nix` to make sure
* `meta.license` must be set and match the upstream license.
* If there is no upstream license, `meta.license` should default to `lib.licenses.unfree`.
* If in doubt, try to contact the upstream developers for clarification.
* `meta.mainProgram` must be set when appropriate.
* `meta.mainProgram` must be set to the name of the executable which facilitates the primary function or purpose of the package, if there is such an executable in `$bin/bin/` (or `$out/bin/`, if there is no `"bin"` output).
* Packages that only have a single executable in the applicable directory above should set `meta.mainProgram`. For example, the package `ripgrep` only has a single executable `rg` under `$out/bin/`, so `ripgrep.meta.mainProgram` is set to `"rg"`.
* Packages like `polkit_gnome` that have no executables in the applicable directory should not set `meta.mainProgram`.
* Packages like `e2fsprogs` that have multiple executables, none of which can be considered the main program, should not set `meta.mainProgram`.
* Packages which are not primarily used for a single executable do not need to set `meta.mainProgram`.
* Always prefer using a hardcoded string (don't use `pname`, for example).
* When in doubt, ask for reviewer input.
* `meta.maintainers` must be set for new packages.
See the Nixpkgs manual for more details on [standard meta-attributes](https://nixos.org/nixpkgs/manual/#sec-standard-meta-attributes).