From 41819ee4536ca36bfcb8e87b29503cf1791b056f Mon Sep 17 00:00:00 2001 From: Liliana Marie Prikler Date: Thu, 6 Jan 2022 15:31:48 +0100 Subject: [PATCH 2/3] Fixup 04/41. Packages with native addons currently try to write to store paths when used as dependecies. This patch adds a phase to replace that behaviour with a no-op. * guix/build/node-build-system.scm (avoid-node-gyp-rebuild): New variable. (%standard-phases): Add 'avoid-node-gyp-rebuild' after 'install'. Signed-off-by: Liliana Marie Prikler --- guix/build/node-build-system.scm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm index d695424e50..1a0e187028 100644 --- a/guix/build/node-build-system.scm +++ b/guix/build/node-build-system.scm @@ -285,12 +285,16 @@ (define installed-package.json (search-input-file outputs (string-append "/lib/node_modules/" (module-name ".") "/package.json"))) - ;; not with-atomic-json-file-replacement, because we usually don't - ;; want or need to overwrite it + ;; We don't want to use an atomic replacement here, because we often don't + ;; even need to overwrite this file. Therefore, let's use some helpers + ;; that we'd otherwise not need. (define pkg-meta (call-with-input-file installed-package.json read-json)) (define scripts (jsobject-ref pkg-meta "scripts" '(@))) + (define (jsobject-set js key val) + (jsobject-update* js (list key (const val)))) + (when (equal? "node-gyp rebuild" (jsobject-ref scripts "install" #f)) (call-with-output-file installed-package.json (lambda (out) -- 2.34.0