mirror of
https://github.com/NixOS/nix.dev.git
synced 2024-10-18 14:32:43 -04:00
Merge pull request #621 from CyberShadow/patch-1
tutorials/first-steps/nix-language: Fix the nixpkgs example
This commit is contained in:
commit
68839d3d60
|
@ -1995,7 +1995,7 @@ Explanation:
|
||||||
### Package
|
### Package
|
||||||
|
|
||||||
```{code-block} nix
|
```{code-block} nix
|
||||||
{ lib, stdenv }:
|
{ lib, stdenv, fetchurl }:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
|
|
||||||
|
@ -2003,7 +2003,7 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
version = "2.12";
|
version = "2.12";
|
||||||
|
|
||||||
src = builtins.fetchTarball {
|
src = fetchurl {
|
||||||
url = "mirror://gnu/${pname}/${pname}-${version}.tar.gz";
|
url = "mirror://gnu/${pname}/${pname}-${version}.tar.gz";
|
||||||
sha256 = "1ayhp9v4m4rdhjmnl2bq3cibrbqqkgjbl3s7yk2nhlh8vj3ay16g";
|
sha256 = "1ayhp9v4m4rdhjmnl2bq3cibrbqqkgjbl3s7yk2nhlh8vj3ay16g";
|
||||||
};
|
};
|
||||||
|
@ -2019,9 +2019,10 @@ This example is a (simplified) package declaration from Nixpkgs.
|
||||||
|
|
||||||
Explanation:
|
Explanation:
|
||||||
|
|
||||||
- This expression is a function that takes an attribute set which must have exactly the attributes `lib` and `stdenv`.
|
- This expression is a function that takes an attribute set which must have exactly the attributes `lib`, `stdenv`, and `fetchurl`.
|
||||||
- It returns the result of evaluating the function `mkDerivation`, which is an attribute of `stdenv`, applied to a recursive set.
|
- It returns the result of evaluating the function `mkDerivation`, which is an attribute of `stdenv`, applied to a recursive set.
|
||||||
- The recursive set passed to `mkDerivation` uses its own `pname` and `version` attributes in the argument to the built-in function `fetchTarball`.
|
- The recursive set passed to `mkDerivation` uses its own `pname` and `version` attributes in the argument to the function `fetchurl`.
|
||||||
|
`fetchurl` itself comes from the outer function's arguments.
|
||||||
- The `meta` attribute is itself an attribute set, where the `license` attribute has the value that was assigned to the nested attribute `lib.licenses.gpl3Plus`.
|
- The `meta` attribute is itself an attribute set, where the `license` attribute has the value that was assigned to the nested attribute `lib.licenses.gpl3Plus`.
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
Loading…
Reference in a new issue