Nixpkgs/Contributing: Difference between revisions
imported>Milahu unindent section headings |
No edit summary |
||
(9 intermediate revisions by 3 users not shown) | |||
Line 7: | Line 7: | ||
== 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 | 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 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. | ||
See [https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#how-to-create-pull-requests How to create pull requests] in nixpkgs CONTRIBUTING.md. | |||
=== Hack Nixpkgs === | === Hack Nixpkgs === | ||
Line 34: | Line 21: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
sudo nixos-rebuild switch -I nixpkgs=/path/to/local/nixpkgs | sudo nixos-rebuild switch -I nixpkgs=/path/to/local/nixpkgs | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 75: | Line 49: | ||
* [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> | ||
=== | ==== Called without required argument ==== | ||
This error is produced by <code>nixpkgs-basic-release-checks</code> (Basic evaluation checks) | |||
<pre> | |||
anonymous function at /path/to/your-package.nix called without required argument 'some-dependency' | |||
</pre> | |||
Usually, a dependency (some-dependency) is not available on a certain platform, | |||
for example on <code>aarch64-darwin</code> | |||
< | To see how other packages handle this dependency: | ||
# | <pre> | ||
cd nixpkgs/pkgs | |||
grep -r some-dependency | |||
# -r = --recursive | |||
</pre> | |||
===== Avoid alias ===== | |||
Solution 1: Replace alias names with the real package names. For example: | |||
* utillinux → util-linux | |||
* double_conversion → double-conversion | |||
===== Make optional ===== | |||
Solution 2: Make it an optional dependency: | |||
<pre> | |||
{ lib | |||
, stdenv | |||
, some-dependency ? null | |||
, another-dependency | |||
}: | |||
stdenv.mkDerivation { | |||
buildInputs = | |||
[ another-dependency ] | |||
++ lib.optionals (!stdenv.isDarwin) [ some-dependency ] | |||
# some-dependency is missing on darwin | |||
; | |||
} | |||
</pre> | |||
=== Manage your local repository === | === Manage your local repository === | ||
Line 100: | Line 101: | ||
== Becoming a Nixpkgs maintainer == | == Becoming a Nixpkgs maintainer == | ||
See [https://github.com/NixOS/nixpkgs/tree/master/maintainers maintainers] in nixpkgs | |||
=== Building all of the packages you maintain === | === Building all of the packages you maintain === | ||
Line 139: | Line 124: | ||
git checkout master #1 | git checkout master #1 | ||
git fetch upstream | git fetch upstream | ||
git | git branch -u upstream/master | ||
</syntaxhighlight> | </syntaxhighlight> | ||
1. make sure you're on the master branch | 1. make sure you're on the master branch | ||
after the above steps you only have to <code>git pull</code> to update the master branch | |||
[https://stackoverflow.com/a/7244456 source] | [https://stackoverflow.com/a/7244456 source] | ||
[[Category:Community]] |