Merge pull request #226280 from gilice/patch-1
This commit is contained in:
commit
21b6b86cd4
1 changed files with 8 additions and 4 deletions
|
@ -16,7 +16,8 @@ stdenv.mkDerivation {
|
|||
}
|
||||
```
|
||||
|
||||
(`stdenv` needs to be in scope, so if you write this in a 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 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](https://github.com/NixOS/rfcs/pull/35), this is preferred for packages in Nixpkgs, as it allows us to reuse the version easily:
|
||||
(`stdenv` needs to be in scope, so if you write this in a 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 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](https://github.com/NixOS/rfcs/pull/35), this is preferred for packages in Nixpkgs**, as it allows us to reuse the version easily:
|
||||
|
||||
```nix
|
||||
stdenv.mkDerivation rec {
|
||||
|
@ -33,7 +34,8 @@ Many packages have dependencies that are not provided in the standard environmen
|
|||
|
||||
```nix
|
||||
stdenv.mkDerivation {
|
||||
name = "libfoo-1.2.3";
|
||||
pname = "libfoo";
|
||||
version = "1.2.3";
|
||||
...
|
||||
buildInputs = [libbar perl ncurses];
|
||||
}
|
||||
|
@ -45,7 +47,8 @@ Often it is necessary to override or modify some aspect of the build. To make th
|
|||
|
||||
```nix
|
||||
stdenv.mkDerivation {
|
||||
name = "fnord-4.5";
|
||||
pname = "fnord";
|
||||
version = "4.5";
|
||||
...
|
||||
buildPhase = ''
|
||||
gcc foo.c -o foo
|
||||
|
@ -65,7 +68,8 @@ While the standard environment provides a generic builder, you can still supply
|
|||
|
||||
```nix
|
||||
stdenv.mkDerivation {
|
||||
name = "libfoo-1.2.3";
|
||||
pname = "libfoo";
|
||||
version = "1.2.3";
|
||||
...
|
||||
builder = ./builder.sh;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue