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
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
91 changes: 66 additions & 25 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,75 @@ This file contains general contributing information, but individual parts also h
- [`doc`](./doc): Sources and infrastructure for the [Nixpkgs manual](https://nixos.org/manual/nixpkgs/stable/)
- [`nixos`](./nixos): Implementation of [NixOS](https://nixos.org/manual/nixos/stable/)

## (Proposing a change) | Submitting changes

Note: contributing implies licensing those contributions
under the terms of [COPYING](COPYING), which is an MIT-like license.
## How to propose a change

This section describes in some detail how changes can be made and proposed with pull requests.

> **Note**
> Be aware that contributing implies licensing those contributions under the terms of [COPYING](./COPYING), an MIT-like license.

0. Set up a local version of Nixpkgs to work with using GitHub and Git
1. [Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo#forking-a-repository) the [Nixpkgs repository](https://github.com/nixos/nixpkgs/).
1. [Clone the forked repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo#cloning-your-forked-repository) into a local `nixpkgs` directory.
1. [Configure the upstream Nixpkgs repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo#configuring-git-to-sync-your-fork-with-the-upstream-repository).
Comment on lines +33 to +35
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works when rendered in through GitHub, but I think you meant 1., 2., 3.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's intentional, I don't really mind either way, but that's an explicitly supported GitHub Markdown feature (and I think effectively all markdown flavors support this)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok good to know. I was just confused when reading through the source code.


1. Create and switch to a new Git branch, ideally such that:
- The name of the branch hints at the change you'd like to implement, e.g. `update-hello`.
- The base of the branch includes the most recent changes on the `master` branch.
> **Note**
> Depending on the change you may want to use a different branch, see <!-- TODO link to branch section -->

```bash
# Make sure you have the latest changes from upstream Nixpkgs
git fetch upstream

# Create and switch to a new branch based off the master branch in Nixpkgs
git switch --create update-hello upstream/master
```

To avoid having to download and build potentially many derivations, at the expense of using a potentially outdated version, you can base the branch off a specific [Git commit](https://www.git-scm.com/docs/gitglossary#def_commit) instead:
- The commit of the latest `nixpkgs-unstable` channel, available [here](https://channels.nixos.org/nixpkgs-unstable/git-revision).
- The commit of a local Nixpkgs downloaded using [nix-channel](https://nixos.org/manual/nix/stable/command-ref/nix-channel), available using `nix-instantiate --eval --expr '(import <nixpkgs/lib>).trivial.revisionWithDefault null'`
- If you're using NixOS, the commit of your NixOS installation, available with `nixos-version --revision`.

Once you have an appropriate commit you can use it instead of `upstream/master` in the above command:
```bash
git switch --create update-hello <the desired base commit>
```

2. Make the desired changes in the local Nixpkgs repository using an editor of your choice.
Make sure to:
- Adhere to both the [general code conventions](#code-conventions), and the code conventions specific to the part you're making changes to.
See the [overview section](#overview) for more specific information.
- Test the changes.
See the [overview section](#overview) for more specific information.
- If necessary, document the change.
See the [overview section](#overview) for more specific information.

3. Commit your changes using `git commit`.
Make sure to adhere to the [commit conventions](#commit-conventions).

Repeat the steps 2 and 3 as many times as necessary.
Advance to the next step if all the commits (viewable with `git log`) make sense together.

4. Push your commits to your fork of Nixpkgs.
```
git push --set-upstream origin HEAD
```

The above command will output a link that allows you to directly quickly do the next step:
```
remote: Create a pull request for 'update-hello' on GitHub by visiting:
remote: https://github.com/myUser/nixpkgs/pull/new/update-hello
```

5. [Create a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request#creating-the-pull-request) from the new branch in your Nixpkgs fork to the upstream Nixpkgs repository.
Generally you should use `master` as the pull requests base branch.
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}

- Read [Manual (How to write packages for Nix)](https://nixos.org/nixpkgs/manual/).

- Fork [the Nixpkgs repository](https://github.com/nixos/nixpkgs/) on GitHub.

- Create a branch for your future fix.

- You can make branch from a commit of your local `nixos-version`. That will help you to avoid additional local compilations. Because you will receive packages from binary cache. For example

```ShellSession
$ nixos-version --hash
0998212
$ git checkout 0998212
$ git checkout -b 'fix/pkg-name-update'
```

- Please avoid working directly on the `master` branch.

- 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
Expand All @@ -64,10 +109,6 @@ under the terms of [COPYING](COPYING), which is an MIT-like license.

### (Creating a pull request)

- Push your changes to your fork of nixpkgs.
- Create the pull request
- Follow [the contribution guidelines](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#submitting-changes).

When pull requests are made, our tooling automation bot,
infinisil marked this conversation as resolved.
Show resolved Hide resolved
[OfBorg](https://github.com/NixOS/ofborg) will perform various checks
to help ensure expression quality.
Expand Down