Jump to content

Nixpkgs/Contributing: Difference between revisions

+ called without required argument
imported>Milahu
(unindent section headings)
imported>Milahu
(+ called without required argument)
Line 74: Line 74:
** Read https://editorconfig.org/#download to configure your editor
** Read https://editorconfig.org/#download to configure your editor
* [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>
Solution: 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>


=== Push to your remote repository ===
=== Push to your remote repository ===
Anonymous user