From 471dfbe96cd2be7279821c33918daf3a5aebcc61 Mon Sep 17 00:00:00 2001 From: Ross Smyth <18294397+RossSmyth@users.noreply.github.com> Date: Wed, 4 Feb 2026 18:19:31 -0500 Subject: [PATCH] doc: Add documentation on nodejsInstallExecutables --- doc/hooks/index.md | 1 + .../nodejs-install-executables.section.md | 29 +++++++++++++++++++ doc/hooks/npm-build-hook.section.md | 9 +++++- doc/redirects.json | 15 ++++++++++ 4 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 doc/hooks/nodejs-install-executables.section.md diff --git a/doc/hooks/index.md b/doc/hooks/index.md index 2cd155ccf173..d0b039217a35 100644 --- a/doc/hooks/index.md +++ b/doc/hooks/index.md @@ -27,6 +27,7 @@ libxml2.section.md meson.section.md mpi-check-hook.section.md ninja.section.md +nodejs-install-executables.section.md npm-build-hook.section.md npm-config-hook.section.md npm-install-hook.section.md diff --git a/doc/hooks/nodejs-install-executables.section.md b/doc/hooks/nodejs-install-executables.section.md new file mode 100644 index 000000000000..7cf1f9ef20e6 --- /dev/null +++ b/doc/hooks/nodejs-install-executables.section.md @@ -0,0 +1,29 @@ +# nodejsInstallExecutables {#nodejs-install-executables} + +Hook for wrapping Node.js executables. +Primarily created for a multi-language environment. + +## Examples {#nodejs-install-executables-example} + +[](#npm-build-hook-example-snippet) + +## Variables controlling `nodejsInstallExecutables` {#nodejs-install-executables-variables} + +### `nodejsInstallExecutables` Exclusive Variables {#nodejs-install-executables-exclusive-variables} + +#### `makeWrapperArgs` {#nodejs-install-executables-wrapper-args} + +Flags to pass to the call to [`makeWrapper`](#fun-makeWrapper). +To avoid double-wrapping, this flag can also be accessed in Bash. + +```nix +stdenv.mkDerivation (finalAttrs: { + #... + dontWrapGApps = true; + + postInstall = '' + makeWrapperArgs+=("''${gappsWrapperArgs[@]}") + ''; + #... +}) +``` diff --git a/doc/hooks/npm-build-hook.section.md b/doc/hooks/npm-build-hook.section.md index d044b3118870..9e09af3589be 100644 --- a/doc/hooks/npm-build-hook.section.md +++ b/doc/hooks/npm-build-hook.section.md @@ -14,6 +14,7 @@ Hook for building packages that use npm. Can be used in multi-language environme fetchFromGitHub, fetchNpmDeps, npmHooks, + nodejsInstallExecutables, nodejs, }: stdenv.mkDerivation (finalAttrs: { @@ -31,6 +32,7 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ nodejs + nodejsInstallExecutables npmHooks.npmConfigHook npmHooks.npmBuildHook npmHooks.npmInstallHook @@ -51,11 +53,16 @@ stdenv.mkDerivation (finalAttrs: { hash = "..."; }; + makeWrapperArgs = [ + "--set" + "NODE_ENV" + "production" + ]; + meta = { description = "npm project"; }; }) - ``` ::: diff --git a/doc/redirects.json b/doc/redirects.json index 498b60182b6b..d69908cb6bad 100644 --- a/doc/redirects.json +++ b/doc/redirects.json @@ -203,6 +203,21 @@ "no-broken-symlinks.sh": [ "index.html#no-broken-symlinks.sh" ], + "nodejs-install-executables": [ + "index.html#nodejs-install-executables" + ], + "nodejs-install-executables-example": [ + "index.html#nodejs-install-executables-example" + ], + "nodejs-install-executables-exclusive-variables": [ + "index.html#nodejs-install-executables-exclusive-variables" + ], + "nodejs-install-executables-variables": [ + "index.html#nodejs-install-executables-variables" + ], + "nodejs-install-executables-wrapper-args": [ + "index.html#nodejs-install-executables-wrapper-args" + ], "nostrictaliasing": [ "index.html#nostrictaliasing" ],