Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up contributing documentation #245243

Merged
merged 42 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
be26d79
doc/contributing: Remove unreferenced legacy diagram
infinisil Jul 21, 2023
d70091c
Create unified markdown files for contributing docs
infinisil Jul 25, 2023
b98abe5
README.md: Rough move to new contribution doc files
infinisil Jul 25, 2023
b7c5258
CONTRIBUTING.md: Rough move to new contribution doc files
infinisil Jul 25, 2023
1e1cd39
doc/coding-conventions: Rough move to new contribution doc files
infinisil Jul 25, 2023
74b17a5
doc/contributing-to-documentation: Rough move to new contribution doc…
infinisil Jul 25, 2023
90bf25d
doc/quick-start: Rough move to new contribution doc files
infinisil Jul 25, 2023
f3a050a
doc/reviewing-contributions: Rough move to new contribution doc files
infinisil Jul 25, 2023
86f14e4
doc/submitting-changes: Rough move to new contribution doc files
infinisil Jul 25, 2023
129da60
doc/vulnerability-roundup: Rough move to new contribution doc files
infinisil Jul 25, 2023
549ecbc
doc: Add empty development section
infinisil Aug 2, 2023
3796808
CONTRIBUTING.md: Move opening issues section to Nixpkgs manual
infinisil Aug 2, 2023
1a29060
CONTRIBUTING.md: Remove temporarily
infinisil Aug 2, 2023
350eb69
Move CONTRIBUTING-new.md to CONTRIBUTING.md
infinisil Aug 2, 2023
3d5fc07
CONTRIBUTING.md: Add intro
infinisil Aug 2, 2023
ecee8c3
CONTRIBUTING.md: Add overview
infinisil Aug 2, 2023
44293fb
pkgs/README.md: Add overview
infinisil Aug 2, 2023
9489e19
CONTRIBUTING.md: Move pull request template section to the bottom
infinisil Aug 2, 2023
dfe311b
CONTRIBUTING.md: Collect paragraphs into a new commit conventions sec…
infinisil Aug 2, 2023
99c6942
CONTRIBUTING.md: Coding conventions -> code conventions
infinisil Aug 2, 2023
67ae88c
CONTRIBUTING.md: Write a new section on how to propose a change
infinisil Aug 2, 2023
5789cc3
CONTRIBUTING.md: Clean up "Making patches" section
infinisil Aug 4, 2023
aace54f
CONTRIBUTING.md: Move flow of changes section up
infinisil Aug 4, 2023
7ab012c
CONTRIBUTING.md: Replace staging workflow diagram
infinisil Aug 4, 2023
9cae397
CONTRIBUTING.md: Clean up and condense staging workflow section
infinisil Aug 7, 2023
b665608
CONTRIBUTING.md: Move release sections together
infinisil Aug 7, 2023
3639a9e
CONTRIBUTING.md: Clean up releases section
infinisil Aug 7, 2023
4e3064d
CONTRIBUTING.md: Minor formatting fixes
infinisil Aug 13, 2023
2f345d0
CONTRIBUTING.md: Remove duplicated section
infinisil Aug 13, 2023
2a99b5a
CONTRIBUTING.md: Move rebasing section up
infinisil Aug 13, 2023
0bd8c9b
CONTRIBUTING.md: New section on which branch to use
infinisil Aug 14, 2023
1665134
CONTRIBUTING.md: Minor fixes
infinisil Aug 14, 2023
b069d2d
CONTRIBUTING.md: Move sections around
infinisil Aug 14, 2023
e630780
pkgs/README.md: Minor header and link fixes
infinisil Aug 14, 2023
553daae
doc/README.md: Cleanup
infinisil Aug 14, 2023
15ca783
nixos/README.md: GitHub markdown fixes
infinisil Aug 14, 2023
d5148f2
maintainer/README.md: GitHub markdown fixes
infinisil Aug 14, 2023
aafc9ae
pkgs/README.md: Remove some mediocre duplicated sentences
infinisil Aug 14, 2023
b0f61e3
CODEOWNERS: Add myself to the newly added files
infinisil Aug 14, 2023
237799a
CONTRIBUTING.md: Minor content updates based on reviews
infinisil Aug 14, 2023
2ce1e0b
CONTRIBUTING.md: Typos and formatting
infinisil Aug 14, 2023
de5a39f
CONTRIBUTING.md: Move boot loader-specific sentence to pkgs/README.md
infinisil Aug 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 23 additions & 28 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,35 +83,28 @@ This section describes in some detail how changes can be made and proposed with
See <!-- TODO branch section link --> for when a different branch should be used instead.
Make sure to go through the [pull request template](#pull-request-template) in the pre-filled default description.

### Making patches {#submitting-changes-making-patches}

- If you removed pkgs or made some major NixOS changes, write about it in the release notes for the next stable release. For example `nixos/doc/manual/release-notes/rl-2003.xml`.

- Test your changes. If you work with

- nixpkgs:

- update pkg
- `nix-env -iA pkg-attribute-name -f <path to your local nixpkgs folder>`
- add pkg
- Make sure it’s in `pkgs/top-level/all-packages.nix`
- `nix-env -iA pkg-attribute-name -f <path to your local nixpkgs folder>`
- _If you don’t want to install pkg in you profile_.
- `nix-build -A pkg-attribute-name <path to your local nixpkgs folder>` and check results in the folder `result`. It will appear in the same directory where you did `nix-build`.
- If you installed your package with `nix-env`, you can run `nix-env -e pkg-name` where `pkg-name` is as reported by `nix-env -q` to uninstall it from your system.

- NixOS and its modules:
- You can add new module to your NixOS configuration file (usually it’s `/etc/nixos/configuration.nix`). And do `sudo nixos-rebuild test -I nixpkgs=<path to your local nixpkgs folder> --fast`.


- [Rebase](https://git-scm.com/book/en/v2/Git-Branching-Rebasing) your branch against current `master`.
6. Respond to review comments, potential CI failures and potential merge conflicts by updating the pull request.
Always keep the pull request in a mergeable state.

To add new commits, repeat steps 2-3 and push the result using
```
git push
```

### (Creating a pull request)
To change existing commits you will have to [rewrite Git history](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History).
Useful Git commands that can help a lot with this are `git commit --patch --amend` and `git rebase --interactive`.
With a rewritten history you need to force-push the commits using
```
git push --force-with-lease
```

When pull requests are made, our tooling automation bot,
[OfBorg](https://github.com/NixOS/ofborg) will perform various checks
to help ensure expression quality.
FRidh marked this conversation as resolved.
Show resolved Hide resolved
In case of merge conflicts you will also have to [rebasing the branch](https://git-scm.com/book/en/v2/Git-Branching-Rebasing) on top of current `master`.
Sometimes this can be done [on GitHub directly](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/keeping-your-pull-request-in-sync-with-the-base-branch#updating-your-pull-request-branch), but if not you will have to rebase locally using
```
git fetch upstream
git rebase upstream/master
git push --force-with-lease
```

#### Rebasing between branches (i.e. from master to staging)

Expand Down Expand Up @@ -417,6 +410,10 @@ However, many changes are able to be backported, including:

## Code conventions

### Release notes

If you removed pkgs or made some major NixOS changes, write about it in the release notes for the next stable release. For example `nixos/doc/manual/release-notes/rl-2003.xml`.

### File naming and organisation {#sec-organisation}

Names of files and directories should be in lowercase, with dashes between words — not in camel case. For instance, it should be `all-packages.nix`, not `allPackages.nix` or `AllPackages.nix`.
Expand Down Expand Up @@ -657,8 +654,6 @@ In addition to writing properly formatted commit messages, it's important to inc
Package version upgrades usually allow for simpler commit messages, including attribute name, old and new version, as well as a reference to the relevant release notes/changelog. Every once in a while a package upgrade requires more extensive changes, and that subsequently warrants a more verbose message.

Pull requests should not be squash merged in order to keep complete commit messages and GPG signatures intact and must not be when the change doesn't make sense as a single commit.
This means that, when addressing review comments in order to keep the pull request in an always mergeable status, you will sometimes need to rewrite your branch's history and then force-push it with `git push --force-with-lease`.
Useful git commands that can help a lot with this are `git commit --patch --amend` and `git rebase --interactive`. For more details consult the git man pages or online resources like [git-rebase.io](https://git-rebase.io/) or [The Pro Git Book](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History).

## Pull Request Template {#submitting-changes-pull-request-template}

Expand Down
4 changes: 4 additions & 0 deletions nixos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ NixOS is a Linux distribution based on the purely functional package
management system Nix. More information can be found at
https://nixos.org/nixos and in the manual in doc/manual.

## Testing changes

You can add new module to your NixOS configuration file (usually it’s `/etc/nixos/configuration.nix`). And do `sudo nixos-rebuild test -I nixpkgs=<path to your local nixpkgs folder> --fast`.

## (Reviewing contributions)

### Module updates {#reviewing-contributions-module-updates}
Expand Down
9 changes: 9 additions & 0 deletions pkgs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,15 @@ This is how the pull request looks like in this case: [https://github.com/NixOS/

## Testing changes | Package tests {#sec-package-tests}

- update pkg
- `nix-env -iA pkg-attribute-name -f <path to your local nixpkgs folder>`
- add pkg
- Make sure it’s in `pkgs/top-level/all-packages.nix`
- `nix-env -iA pkg-attribute-name -f <path to your local nixpkgs folder>`
- _If you don’t want to install pkg in you profile_.
- `nix-build -A pkg-attribute-name <path to your local nixpkgs folder>` and check results in the folder `result`. It will appear in the same directory where you did `nix-build`.
- If you installed your package with `nix-env`, you can run `nix-env -e pkg-name` where `pkg-name` is as reported by `nix-env -q` to uninstall it from your system.

To run the main types of tests locally:

- Run package-internal tests with `nix-build --attr pkgs.PACKAGE.passthru.tests`
Expand Down