1 # Reviewing contributions {#chap-reviewing-contributions}
4 The following section is a draft, and the policy for reviewing is still being discussed in issues such as [#11166](https://github.com/NixOS/nixpkgs/issues/11166) and [#20836](https://github.com/NixOS/nixpkgs/issues/20836).
7 The Nixpkgs project receives a fairly high number of contributions via GitHub pull requests. Reviewing and approving these is an important task and a way to contribute to the project.
9 The high change rate of Nixpkgs makes any pull request that remains open for too long subject to conflicts that will require extra work from the submitter or the merger. Reviewing pull requests in a timely manner and being responsive to the comments is the key to avoid this issue. GitHub provides sort filters that can be used to see the [most recently](https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc) and the [least recently](https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-asc) updated pull requests. We highly encourage looking at [this list of ready to merge, unreviewed pull requests](https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+review%3Anone+status%3Asuccess+-label%3A%222.status%3A+work-in-progress%22+no%3Aproject+no%3Aassignee+no%3Amilestone).
11 When reviewing a pull request, please always be nice and polite. Controversial changes can lead to controversial opinions, but it is important to respect every community member and their work.
13 GitHub provides reactions as a simple and quick way to provide feedback to pull requests or any comments. The thumb-down reaction should be used with care and if possible accompanied with some explanation so the submitter has directions to improve their contribution.
15 pull request reviews should include a list of what has been reviewed in a comment, so other reviewers and mergers can know the state of the review.
17 All the review template samples provided in this section are generic and meant as examples. Their usage is optional and the reviewer is free to adapt them to their liking.
19 ## Package updates {#reviewing-contributions-package-updates}
21 A package update is the most trivial and common type of pull request. These pull requests mainly consist of updating the version part of the package name and the source hash.
23 It can happen that non-trivial updates include patches or more complex changes.
27 - Ensure that the package versioning fits the guidelines.
28 - Ensure that the commit text fits the guidelines.
29 - Ensure that the package maintainers are notified.
30 - [CODEOWNERS](https://help.github.com/articles/about-codeowners) will make GitHub notify users based on the submitted changes, but it can happen that it misses some of the package maintainers.
31 - Ensure that the meta field information is correct.
32 - License can change with version updates, so it should be checked to match the upstream license.
33 - If the package has no maintainer, a maintainer must be set. This can be the update submitter or a community member that accepts to take maintainership of the package.
34 - Ensure that the code contains no typos.
35 - Building the package locally.
36 - pull requests are often targeted to the master or staging branch, and building the pull request locally when it is submitted can trigger many source builds.
37 - It is possible to rebase the changes on nixos-unstable or nixpkgs-unstable for easier review by running the following commands from a nixpkgs clone.
40 $ git fetch origin nixos-unstable
41 $ git fetch origin pull/PRNUMBER/head
42 $ git rebase --onto nixos-unstable BASEBRANCH FETCH_HEAD
45 - The first command fetches the nixos-unstable branch.
46 - The second command fetches the pull request changes, `PRNUMBER` is the number at the end of the pull request title and `BASEBRANCH` the base branch of the pull request.
47 - The third command rebases the pull request changes to the nixos-unstable branch.
48 - The [nixpkgs-review](https://github.com/Mic92/nixpkgs-review) tool can be used to review a pull request content in a single command. `PRNUMBER` should be replaced by the number at the end of the pull request title. You can also provide the full github pull request url.
51 $ nix-shell -p nixpkgs-review --run "nixpkgs-review pr PRNUMBER"
53 - Running every binary.
55 Sample template for a package update review is provided below.
60 - [ ] package name fits guidelines
61 - [ ] package version fits guidelines
62 - [ ] package build on ARCHITECTURE
63 - [ ] executables tested on ARCHITECTURE
64 - [ ] all depending packages build
66 ##### Possible improvements
71 ## New packages {#reviewing-contributions-new-packages}
73 New packages are a common type of pull requests. These pull requests consists in adding a new nix-expression for a package.
77 - Ensure that the package versioning fits the guidelines.
78 - Ensure that the commit name fits the guidelines.
79 - Ensure that the meta fields contain correct information.
80 - License must match the upstream license.
81 - Platforms should be set (or the package will not get binary substitutes).
82 - Maintainers must be set. This can be the package submitter or a community member that accepts taking up maintainership of the package.
83 - Report detected typos.
84 - Ensure the package source:
85 - Uses mirror URLs when available.
86 - Uses the most appropriate functions (e.g. packages from GitHub should use `fetchFromGitHub`).
87 - Building the package locally.
88 - Running every binary.
90 Sample template for a new package review is provided below.
95 - [ ] package path fits guidelines
96 - [ ] package name fits guidelines
97 - [ ] package version fits guidelines
98 - [ ] package build on ARCHITECTURE
99 - [ ] executables tested on ARCHITECTURE
100 - [ ] `meta.description` is set and fits guidelines
101 - [ ] `meta.license` fits upstream license
102 - [ ] `meta.platforms` is set
103 - [ ] `meta.maintainers` is set
104 - [ ] build time only dependencies are declared in `nativeBuildInputs`
105 - [ ] source is fetched using the appropriate function
106 - [ ] the list of `phases` is not overridden
107 - [ ] when a phase (like `installPhase`) is overridden it starts with `runHook preInstall` and ends with `runHook postInstall`.
108 - [ ] patches that are remotely available are fetched with `fetchpatch`
110 ##### Possible improvements
115 ## Module updates {#reviewing-contributions-module-updates}
117 Module updates are submissions changing modules in some ways. These often contains changes to the options or introduce new options.
121 - Ensure that the module maintainers are notified.
122 - [CODEOWNERS](https://help.github.com/articles/about-codeowners/) will make GitHub notify users based on the submitted changes, but it can happen that it misses some of the package maintainers.
123 - Ensure that the module tests, if any, are succeeding.
124 - Ensure that the introduced options are correct.
125 - Type should be appropriate (string related types differs in their merging capabilities, `loaOf` and `string` types are deprecated).
126 - Description, default and example should be provided.
127 - Ensure that option changes are backward compatible.
128 - `mkRenamedOptionModuleWith` provides a way to make option changes backward compatible.
129 - Ensure that removed options are declared with `mkRemovedOptionModule`
130 - Ensure that changes that are not backward compatible are mentioned in release notes.
131 - Ensure that documentations affected by the change is updated.
133 Sample template for a module update review is provided below.
136 ##### Reviewed points
138 - [ ] changes are backward compatible
139 - [ ] removed options are declared with `mkRemovedOptionModule`
140 - [ ] changes that are not backward compatible are documented in release notes
141 - [ ] module tests succeed on ARCHITECTURE
142 - [ ] options types are appropriate
143 - [ ] options description is set
144 - [ ] options example is provided
145 - [ ] documentation affected by the changes is updated
147 ##### Possible improvements
152 ## New modules {#reviewing-contributions-new-modules}
154 New modules submissions introduce a new module to NixOS.
158 - Ensure that the module tests, if any, are succeeding.
159 - Ensure that the introduced options are correct.
160 - Type should be appropriate (string related types differs in their merging capabilities, `loaOf` and `string` types are deprecated).
161 - Description, default and example should be provided.
162 - Ensure that module `meta` field is present
163 - Maintainers should be declared in `meta.maintainers`.
164 - Module documentation should be declared with `meta.doc`.
165 - Ensure that the module respect other modules functionality.
166 - For example, enabling a module should not open firewall ports by default.
168 Sample template for a new module review is provided below.
171 ##### Reviewed points
173 - [ ] module path fits the guidelines
174 - [ ] module tests succeed on ARCHITECTURE
175 - [ ] options have appropriate types
176 - [ ] options have default
177 - [ ] options have example
178 - [ ] options have descriptions
179 - [ ] No unneeded package is added to environment.systemPackages
180 - [ ] meta.maintainers is set
181 - [ ] module documentation is declared in meta.doc
183 ##### Possible improvements
188 ## Individual maintainer list {#reviewing-contributions-indvidual-maintainer-list}
190 When adding users to `maintainers/maintainer-list.nix`, the following
191 checks should be performed:
193 - If the user has specified a GPG key, verify that the commit is
196 First, validate that the commit adding the maintainer is signed by
197 the key the maintainer listed. Check out the pull request and
198 compare its signing key with the listed key in the commit.
200 If the commit is not signed or it is signed by a different user, ask
201 them to either recommit using that key or to remove their key
204 Given a maintainter entry like this:
209 email = "user@example.com";
210 name = "Example User";
212 fingerprint = "0000 0000 2A70 6423 0AED 3C11 F04F 7A19 AAA6 3AFE";
218 First receive their key from a keyserver:
220 $ gpg --recv-keys 0xF04F7A19AAA63AFE
221 gpg: key 0xF04F7A19AAA63AFE: public key "Example <user@example.com>" imported
222 gpg: Total number processed: 1
225 Then check the commit is signed by that key:
227 $ git log --show-signature
228 commit b87862a4f7d32319b1de428adb6cdbdd3a960153
229 gpg: Signature made Wed Mar 12 13:32:24 2003 +0000
230 gpg: using RSA key 000000002A7064230AED3C11F04F7A19AAA63AFE
231 gpg: Good signature from "Example User <user@example.com>
232 Author: Example User <user@example.com>
233 Date: Wed Mar 12 13:32:24 2003 +0000
235 maintainers: adding example
237 and validate that there is a `Good signature` and the printed key
238 matches the user's submitted key.
240 Note: GitHub's "Verified" label does not display the user's full key
241 fingerprint, and should not be used for validating the key matches.
243 - If the user has specified a `github` account name, ensure they have
244 also specified a `githubId` and verify the two match.
246 Maintainer entries that include a `github` field must also include
247 their `githubId`. People can and do change their GitHub name
248 frequently, and the ID is used as the official and stable identity
251 Given a maintainer entry like this:
256 email = "user@example.com";
257 name = "Example User";
264 First, make sure that the listed GitHub handle matches the author of
267 Then, visit the URL `https://api.github.com/users/ghost` and
268 validate that the `id` field matches the provided `githubId`.
270 ## Maintainer teams {#reviewing-contributions-maintainer-teams}
272 Feel free to create a new maintainer team in `maintainers/team-list.nix`
273 when a group is collectively responsible for a collection of packages.
274 Use taste and personal judgement when deciding if a team is warranted.
276 Teams are allowed to define their own rules about membership.
278 For example, some teams will represent a business or other group which
279 wants to carefully track its members. Other teams may be very open about
280 who can join, and allow anybody to participate.
282 When reviewing changes to a team, read the team's scope and the context
283 around the member list for indications about the team's membership
286 In any case, request reviews from the existing team members. If the team
287 lists no specific membership policy, feel free to merge changes to the
288 team after giving the existing members a few days to respond.
290 *Important:* If a team says it is a closed group, do not merge additions
291 to the team without an approval by at least one existing member.
293 ## Other submissions {#reviewing-contributions-other-submissions}
295 Other type of submissions requires different reviewing steps.
297 If you consider having enough knowledge and experience in a topic and would like to be a long-term reviewer for related submissions, please contact the current reviewers for that topic. They will give you information about the reviewing process. The main reviewers for a topic can be hard to find as there is no list, but checking past pull requests to see who reviewed or git-blaming the code to see who committed to that topic can give some hints.
299 Container system, boot system and library changes are some examples of the pull requests fitting this category.
301 ## Merging pull requests {#reviewing-contributions--merging-pull-requests}
303 It is possible for community members that have enough knowledge and experience on a special topic to contribute by merging pull requests.
305 In case the PR is stuck waiting for the original author to apply a trivial
306 change (a typo, capitalisation change, etc.) and the author allowed the members
307 to modify the PR, consider applying it yourself. (or commit the existing review
308 suggestion) You should pay extra attention to make sure the addition doesn't go
309 against the idea of the original PR and would not be opposed by the author.
312 The following paragraphs about how to deal with unactive contributors is just a proposition and should be modified to what the community agrees to be the right policy.
314 Please note that contributors with commit rights unactive for more than three months will have their commit rights revoked.
317 Please see the discussion in [GitHub nixpkgs issue #50105](https://github.com/NixOS/nixpkgs/issues/50105) for information on how to proceed to be granted this level of access.
319 In a case a contributor definitively leaves the Nix community, they should create an issue or post on [Discourse](https://discourse.nixos.org) with references of packages and modules they maintain so the maintainership can be taken over by other contributors.