2015-04-07 14:11:59 +01:00
# How to contribute
## Opening issues
* Make sure you have a [GitHub account ](https://github.com/signup/free )
2015-06-21 16:32:54 +01:00
* [Submit an issue ](https://github.com/NixOS/nixpkgs/issues ) - assuming one does not already exist.
* Clearly describe the issue including steps to reproduce when it is a bug.
* Include information what version of nixpkgs and Nix are you using (nixos-version or git revision).
2015-04-07 14:11:59 +01:00
## Making patches
2015-06-21 16:32:54 +01:00
* Read [Manual (How to write packages for Nix) ](https://nixos.org/nixpkgs/manual/ ).
2015-04-07 14:11:59 +01:00
* Fork the repository on GitHub.
* Create a branch for your future fix.
2015-06-21 13:37:54 +01:00
* You can make branch from a commit of your local `nixos-version` . That will help you to avoid additional local compilations. Because you will recieve packages from binary cache.
2015-04-07 14:11:59 +01:00
* For example: `nixos-version` returns `15.05.git.0998212 (Dingo)` . So you can do:
```bash
git checkout 0998212
git checkout -b 'fix/pkg-name-update'
```
* Please avoid working directly on the `master` branch.
2015-07-10 21:54:11 +01:00
* Make commits of logical units.
2015-06-21 13:37:54 +01:00
* If you removed pkgs, made some major NixOS changes etc., write about them in `nixos/doc/manual/release-notes/rl-unstable.xml` .
2015-04-07 14:11:59 +01:00
* Check for unnecessary whitespace with `git diff --check` before committing.
* Format the commit in a following way:
```
2015-06-21 13:37:54 +01:00
(pkg-name | service-name): (from -> to | init at version | refactor | etc)
2015-04-07 14:11:59 +01:00
Additional information.
```
* Examples:
2015-06-21 13:29:30 +01:00
* `nginx: init at 2.0.1`
2015-06-21 13:37:54 +01:00
* `firefox: 3.0 -> 3.1.1`
2015-06-21 13:29:30 +01:00
* `hydra service: add bazBaz option`
* `nginx service: refactor config generation`
2015-06-21 16:32:54 +01:00
* Test your changes. If you work with
* nixpkgs:
2015-07-10 21:54:11 +01:00
* update pkg ->
2015-04-07 14:11:59 +01:00
* `nix-env -i pkg-name -f <path to your local nixpkgs folder>`
2015-07-10 21:54:11 +01:00
* add pkg ->
2015-04-07 14:11:59 +01:00
* Make sure it's in `pkgs/top-level/all-packages.nix`
* `nix-env -i pkg-name -f <path to your local nixpkgs folder>`
2015-07-10 21:54:11 +01:00
* _If you don't want to install pkg in you profile_.
2015-04-07 14:11:59 +01:00
* `nix-build -A pkg-attribute-name <path to your local nixpkgs folder>/default.nix` and check results in the folder `result` . It will appear in the same directory where you did `nix-build` .
* If you did `nix-env -i pkg-name` you can do `nix-env -e pkg-name` to uninstall it from your system.
2015-06-21 16:32:54 +01:00
* 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` .
2015-04-07 14:11:59 +01:00
* If you have commits `pkg-name: oh, forgot to insert whitespace` : squash commits in this case. Use `git rebase -i` .
* Rebase you branch against current `master` .
## Submitting changes
* Push your changes to your fork of nixpkgs.
2015-06-21 16:32:54 +01:00
* Create pull request:
* Write the title in format `(pkg-name | service): improvement` .
* If you update the pkg, write versions `from -> to` .
2015-06-17 21:57:30 +01:00
* Write in comment if you have tested your patch. Do not rely much on `TravisCI` .
2015-06-21 16:32:54 +01:00
* If you make an improvement, write about your motivation.
* Notify maintainers of the package. For example add to the message: `cc @jagajaga @domenkozar` .
2015-04-07 14:11:59 +01:00
## Hotfixing pull requests
2015-06-21 16:32:54 +01:00
* Make the appropriate changes in you branch.
* Don't create additional commits, do
* `git rebase -i`
* `git push --force` to your branch.
2015-07-10 10:56:04 +01:00
## Commit policy
2015-07-10 21:54:11 +01:00
* Commits must be sufficiently tested before being merged, both for the master and staging branches.
* Hydra builds for master and staging should not be used as testing platform, it's a build farm for changes that have been already tested.
2015-07-10 10:56:04 +01:00
* Master should only see non-breaking commits that do not cause mass rebuilds.
2015-07-10 21:54:11 +01:00
* Staging should only see non-breaking mass-rebuild commits. That means it's not to be used for testing, and changes must have been well tested already. [Read policy here ](http://comments.gmane.org/gmane.linux.distributions.nixos/13447 ).
2015-07-10 10:56:04 +01:00
* If staging is already in a broken state, please refrain from adding extra new breakages. Stabilize it for a few days, merge into master, then resume development on staging. [Keep an eye on the staging evaluations here ](http://hydra.nixos.org/jobset/nixpkgs/staging#tabs-evaluations ).
2015-07-10 21:54:11 +01:00
* When changing the bootloader installation process, extra care must be taken. Grub installations cannot be rolled back, hence changes may break people's installations forever. For any non-trivial change to the bootloader please file a PR asking for review, especially from @edolstra .