diff --git a/doc/stdenv.xml b/doc/stdenv.xml
index a14d78afe71a5f..d89c368d284b26 100644
--- a/doc/stdenv.xml
+++ b/doc/stdenv.xml
@@ -31,9 +31,28 @@ stdenv.mkDerivation {
separate Nix expression from pkgs/all-packages.nix, you
need to pass it as a function argument.) Specifying a
name and a src 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 buildInputs attribute:
+ Nix requires. For convenience, you can also use pname and
+ version attributes and mkDerivation
+ will automatically set name to
+ "${pname}-${version}" by default. Since
+ RFC 0035,
+ this is preferred for packages in Nixpkgs, as it allows us to reuse the
+ version easily:
+
+stdenv.mkDerivation rec {
+ name = "libfoo";
+ version = "1.2.3";
+ src = fetchurl {
+ url = "http://example.org/libfoo-source-${version}.tar.bz2";
+ sha256 = "0x2g1jqygyr5wiwg4ma1nd7w4ydpy82z9gkcv8vh2v8dn3y58v5m";
+ };
+}
+
+
+
+ Many packages have dependencies that are not provided in the standard
+ environment. It’s usually sufficient to specify those dependencies in the
+ buildInputs attribute:
stdenv.mkDerivation {
name = "libfoo-1.2.3";