[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#51838] [PATCH v4 04/45] gnu: node: Add an npmrc file to set nodedir
From: |
Philip McGrath |
Subject: |
[bug#51838] [PATCH v4 04/45] gnu: node: Add an npmrc file to set nodedir. |
Date: |
Mon, 13 Dec 2021 01:00:26 -0500 |
* gnu/packages/node.scm (node, node-lts)[arguments]: Add a phase
'install-npmrc to create a "built-in" npmrc file that configures
"nodedir" to point to the output store path.
(libnode)[arguments]: Delete the 'install-npmrc phase.
---
gnu/packages/node.scm | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index a57a74fb81..346cbd488d 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -250,7 +250,24 @@ (define-public node
(find-files (string-append prefix "/lib/node_modules")
(lambda (file stat)
(executable-file? file))
- #:stat lstat))))))))
+ #:stat lstat)))))
+ (add-after 'install 'install-npmrc
+ ;; Note: programs like node-gyp only receive these values if
+ ;; they are started via `npm` or `npx`.
+ ;; See: https://github.com/nodejs/node-gyp#npm-configuration
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out")))
+ (with-output-to-file
+ ;; Use the config file "primarily for distribution
+ ;; maintainers" rather than "{prefix}/etc/npmrc",
+ ;; especially because node-build-system uses --prefix
+ ;; to install things to their store paths:
+ (string-append out "/lib/node_modules/npm/npmrc")
+ (lambda ()
+ ;; Tell npm (mostly node-gyp) where to find our
+ ;; installed headers so it doesn't try to
+ ;; download them from the internet:
+ (format #t "nodedir=~a\n" out)))))))))
(native-inputs
`(;; Runtime dependencies for binaries used as a bootstrap.
("c-ares" ,c-ares)
@@ -818,4 +835,5 @@ (define-public libnode
`(cons* "--shared" "--without-npm" ,flags))
((#:phases phases '%standard-phases)
`(modify-phases ,phases
+ (delete 'install-npmrc)
(delete 'patch-nested-shebangs)))))))
--
2.32.0
- [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp., Philip McGrath, 2021/12/02
- [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp., Liliana Marie Prikler, 2021/12/03
- [bug#51838] [PATCH v3 00/43] guix: node-build-system: Support compiling add-ons with node-gyp., Philip McGrath, 2021/12/08
- [bug#51838] [PATCH v3 01/43] gnu: node: Avoid duplicating build phases., Philip McGrath, 2021/12/08
- [bug#51838] [PATCH v3 04/43] gnu: node: Add an npmrc file to set nodedir., Philip McGrath, 2021/12/08
- [bug#51838] [PATCH v3 04/43] gnu: node: Add an npmrc file to set nodedir., Pierre Langlois, 2021/12/12
- [bug#51838] [PATCH v3 04/43] gnu: node: Add an npmrc file to set nodedir., Philip McGrath, 2021/12/12
- [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp., Philip McGrath, 2021/12/13
- [bug#51838] [PATCH v4 01/45] gnu: node: Avoid duplicating build phases., Philip McGrath, 2021/12/13
- [bug#51838] [PATCH v4 04/45] gnu: node: Add an npmrc file to set nodedir.,
Philip McGrath <=
- [bug#51838] [PATCH v4 02/45] gnu: node: Update to 10.24.1 for bootstrapping., Philip McGrath, 2021/12/13
- [bug#51838] [PATCH v4 03/45] gnu: node: Patch shebangs in node_modules., Philip McGrath, 2021/12/13
- [bug#51838] [PATCH v4 06/45] guix: node-build-system: Refactor patch-dependencies phase., Philip McGrath, 2021/12/13
- [bug#51838] [PATCH v4 07/45] guix: node-build-system: Add #:absent-dependencies argument., Philip McGrath, 2021/12/13
- [bug#51838] [PATCH v4 05/45] guix: node-build-system: Add delete-lockfiles phase., Philip McGrath, 2021/12/13
- [bug#51838] [PATCH v4 08/45] gnu: node-semver-bootstrap: Use #:absent-dependencies., Philip McGrath, 2021/12/13
- [bug#51838] [PATCH v4 10/45] gnu: node-binary-search-bootstrap: Use #:absent-dependencies., Philip McGrath, 2021/12/13
- [bug#51838] [PATCH v4 11/45] gnu: node-debug-bootstrap: Use #:absent-dependencies., Philip McGrath, 2021/12/13
- [bug#51838] [PATCH v4 09/45] gnu: node-ms-bootstrap: Use #:absent-dependencies., Philip McGrath, 2021/12/13
- [bug#51838] [PATCH v4 12/45] gnu: node-llparse-builder-bootstrap: Use #:absent-dependencies., Philip McGrath, 2021/12/13