Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ad2a9cdd8f55
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 902952d3a3c1
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Jun 16, 2019

  1. doc: describe pname

    This was forgotten when RFC 0035 was implemented.
    jtojnar authored and FRidh committed Jun 16, 2019
    Copy the full SHA
    902952d View commit details
Showing with 22 additions and 3 deletions.
  1. +22 −3 doc/stdenv.xml
25 changes: 22 additions & 3 deletions doc/stdenv.xml
Original file line number Diff line number Diff line change
@@ -31,9 +31,28 @@ stdenv.mkDerivation {
separate Nix expression from <filename>pkgs/all-packages.nix</filename>, you
need to pass it as a function argument.) Specifying a
<varname>name</varname> and a <varname>src</varname> is the absolute minimum
you need to do. Many packages have dependencies that are not provided in the
standard environment. It’s usually sufficient to specify those
dependencies in the <varname>buildInputs</varname> attribute:
Nix requires. For convenience, you can also use <varname>pname</varname> and
<varname>version</varname> attributes and <literal>mkDerivation</literal>
will automatically set <varname>name</varname> to
<literal>"${pname}-${version}"</literal> by default. Since
<link xlink:href="https://github.com/NixOS/rfcs/pull/35">RFC 0035</link>,
this is preferred for packages in Nixpkgs, as it allows us to reuse the
version easily:
<programlisting>
stdenv.mkDerivation rec {
name = "libfoo";
version = "1.2.3";
src = fetchurl {
url = "http://example.org/libfoo-source-${version}.tar.bz2";
sha256 = "0x2g1jqygyr5wiwg4ma1nd7w4ydpy82z9gkcv8vh2v8dn3y58v5m";
};
}</programlisting>
</para>

<para>
Many packages have dependencies that are not provided in the standard
environment. It’s usually sufficient to specify those dependencies in the
<varname>buildInputs</varname> attribute:
<programlisting>
stdenv.mkDerivation {
name = "libfoo-1.2.3";