doc: use finalAttrs pattern

This commit is contained in:
Pol Dellaiera 2025-04-19 22:09:31 +02:00
parent 47f000d991
commit b4515ff6c2
8 changed files with 57 additions and 55 deletions

View file

@ -198,14 +198,14 @@ Here's an example:
fetchFromGitHub,
}:
buildNpmPackage rec {
buildNpmPackage (finalAttrs: {
pname = "flood";
version = "4.7.0";
src = fetchFromGitHub {
owner = "jesec";
repo = pname;
rev = "v${version}";
rev = "v${finalAttrs.version}";
hash = "sha256-BR+ZGkBBfd0dSQqAvujsbgsEPFYw/ThrylxUbOksYxM=";
};
@ -222,7 +222,7 @@ buildNpmPackage rec {
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ winter ];
};
}
})
```
In the default `installPhase` set by `buildNpmPackage`, it uses `npm pack --json --dry-run` to decide what files to install in `$out/lib/node_modules/$name/`, where `$name` is the `name` string defined in the package's `package.json`.