Nixpkgs/Contributing: Difference between revisions

imported>Milahu
+ Run tests locally
imported>Milahu
unindent section headings
Line 1: Line 1:
== Contributing ==
Development in NixOS primarily driven by the work in [https://github.com/nixos/nixpkgs nixpkgs on GitHub]. This repository contains both all packages available in your NixOS channel and all the options you can use for configuring your system with your <code>configuration.nix</code>. To get your text editor to recognize Nix expressions, consider installing a Nix [[Editor Modes for Nix Files]].
Development in NixOS primarily driven by the work in [https://github.com/nixos/nixpkgs nixpkgs on GitHub]. This repository contains both all packages available in your NixOS channel and all the options you can use for configuring your system with your <code>configuration.nix</code>. To get your text editor to recognize Nix expressions, consider installing a Nix [[Editor Modes for Nix Files]].


=== Report issues ===
== Report issues ==


Any issue can be reported in the [https://github.com/nixos/nixpkgs/issues nixpkgs issue tracker] on GitHub. Keep in mind that all work on nixpkgs is being done by volunteers and you cannot expect a quick response and solution for all problems you may face. In general Pull Requests have a much shorter round-trip-time.
Any issue can be reported in the [https://github.com/nixos/nixpkgs/issues nixpkgs issue tracker] on GitHub. Keep in mind that all work on nixpkgs is being done by volunteers and you cannot expect a quick response and solution for all problems you may face. In general Pull Requests have a much shorter round-trip-time.


=== Create pull requests ===
== Create pull requests ==


If you want to see your package being provided by a channel, creating an issue will most likely not enough. It is up to you to create a [[Contributing to Nixpkgs|nix package description]] in Nixpkgs and create a pull request in the Nixpkgs repository. Pull requests are a way to tell a GitHub project that you've created some changes, which maintainers can easily review, comment on and, and finally merge into the repository.
If you want to see your package being provided by a channel, creating an issue will most likely not enough. It is up to you to create a [[Contributing to Nixpkgs|nix package description]] in Nixpkgs and create a pull request in the Nixpkgs repository. Pull requests are a way to tell a GitHub project that you've created some changes, which maintainers can easily review, comment on and, and finally merge into the repository.
Line 13: Line 11:
Here's how to create a pull request on GitHub:
Here's how to create a pull request on GitHub:


==== Fork Nixpkgs on Github ====
=== Fork Nixpkgs on Github ===


Create a GitHub account and fork the [https://github.com/NixOS/nixpkgs nixpkgs repository].  
Create a GitHub account and fork the [https://github.com/NixOS/nixpkgs nixpkgs repository].  


==== Add a remote ====
=== Add a remote ===


On your host, create a new remote location:
On your host, create a new remote location:
Line 26: Line 24:
</syntaxhighlight>
</syntaxhighlight>


==== Hack Nixpkgs ====
=== Hack Nixpkgs ===


Make any modifications you want to your local copy of the repository, then build the package from the root of the <code>nixpkgs</code> directory with: <syntaxhighlight lang="bash">nix-build -A $yourpackage</syntaxhighlight>
Make any modifications you want to your local copy of the repository, then build the package from the root of the <code>nixpkgs</code> directory with: <syntaxhighlight lang="bash">nix-build -A $yourpackage</syntaxhighlight>
Line 38: Line 36:
</syntaxhighlight>
</syntaxhighlight>


==== Commit your change locally ====
=== Commit your change locally ===


Commit your change to your local clone of the repository:
Commit your change to your local clone of the repository:
Line 45: Line 43:
git commit
git commit


==== Check status ====
=== Check status ===


Verify everything is ok - no unexpected dangling files git does not know about yet:
Verify everything is ok - no unexpected dangling files git does not know about yet:
Line 51: Line 49:
</syntaxhighlight>
</syntaxhighlight>


==== Run tests locally ====
=== Run tests locally ===


Pushing commits to Github will run tests on Github.<br>
Pushing commits to Github will run tests on Github.<br>
Line 77: Line 75:
* [https://github.com/NixOS/ofborg#how-does-ofborg-call-nix-build ofborg-eval] will call <code>nix-build -A $yourpackage</code>
* [https://github.com/NixOS/ofborg#how-does-ofborg-call-nix-build ofborg-eval] will call <code>nix-build -A $yourpackage</code>


==== Push to your remote repository ====
=== Push to your remote repository ===


Submitting your change, push to your repository:
Submitting your change, push to your repository:
Line 92: Line 90:
You can always switch back to master by <code>git checkout master</code>.
You can always switch back to master by <code>git checkout master</code>.


==== Create a pull request on GitHub ====
=== Create a pull request on GitHub ===


Go to [https://github.com/nixos/nixpkgs the Nixpkgs repository] and push the ''create pull request'' button. Add a description of your work and submit.
Go to [https://github.com/nixos/nixpkgs the Nixpkgs repository] and push the ''create pull request'' button. Add a description of your work and submit.


==== Manage your local repository ====
=== Manage your local repository ===


Tips & tricks for managing your <code>nixpkgs</code> checkout are kept in the [[Git#Management_of_the_nixpkgs_git_repository|page on git]].
Tips & tricks for managing your <code>nixpkgs</code> checkout are kept in the [[Git#Management_of_the_nixpkgs_git_repository|page on git]].


=== Becoming a Nixpkgs maintainer ===
== Becoming a Nixpkgs maintainer ==


There are two types of maintainer: Members of the NixOS organization and package/module maintainer.
There are two types of maintainer: Members of the NixOS organization and package/module maintainer.