From patchwork Fri Dec 17 02:02:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 35301 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id D2B9A27BBEB; Fri, 17 Dec 2021 02:05:59 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 841AF27BBE9 for ; Fri, 17 Dec 2021 02:05:59 +0000 (GMT) Received: from localhost ([::1]:50862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1my2dC-0003Cj-Md for patchwork@mira.cbaines.net; Thu, 16 Dec 2021 21:05:58 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1my2cL-00037l-DI for guix-patches@gnu.org; Thu, 16 Dec 2021 21:05:14 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:53987) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1my2cI-0007YH-RU for guix-patches@gnu.org; Thu, 16 Dec 2021 21:05:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1my2cI-00055P-ME for guix-patches@gnu.org; Thu, 16 Dec 2021 21:05:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51838] [PATCH v5 04/45] gnu: node: Add an npmrc file to set nodedir. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 17 Dec 2021 02:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51838 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51838@debbugs.gnu.org Cc: Timothy Sample , Pierre Langlois , Jelle Licht , Philip McGrath , Liliana Marie Prikler Received: via spool by 51838-submit@debbugs.gnu.org id=B51838.163970665519346 (code B ref 51838); Fri, 17 Dec 2021 02:05:02 +0000 Received: (at 51838) by debbugs.gnu.org; 17 Dec 2021 02:04:15 +0000 Received: from localhost ([127.0.0.1]:37269 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1my2bX-00051x-6R for submit@debbugs.gnu.org; Thu, 16 Dec 2021 21:04:15 -0500 Received: from mail-qt1-f170.google.com ([209.85.160.170]:33531) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1my2bQ-00051Q-VS for 51838@debbugs.gnu.org; Thu, 16 Dec 2021 21:04:09 -0500 Received: by mail-qt1-f170.google.com with SMTP id n15so1261817qta.0 for <51838@debbugs.gnu.org>; Thu, 16 Dec 2021 18:04:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philipmcgrath.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pAjgFEXwjFWIf/Xl/G42tFKyq9sxXqZV9/ZAN/eqYGI=; b=FehbZ2xqRw5sgrY4a2m34n8XWEXvXOBSYVNoWyry+wByHEyReD/Gb2Bh1LBdmdig7k axjrMPLIVvFG15zD7jThqvZoWpc04qB0shzGW1o28VkqeDDBq3/SBM+z8qyCsA4l5oOl 9rm9BImCyz3lKZJPJoRC3uaPxh9ArjX/7na45/gGsCE8AvjobQM1K/cNdsHLIrECDDMY EkujuTdyS2voOGmC1savCWGD12xTTEK3E5AWGlFZjRC6rSEi+jAWjbaUK6BkhCYOAr6p YLfgJzhB9LHeILb0wYP7YK5wroR3Fj5wVk27kn13TyxyLeaKgsnaXaujFgpzzYme9OK5 UrPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pAjgFEXwjFWIf/Xl/G42tFKyq9sxXqZV9/ZAN/eqYGI=; b=QpBJDwnw5BGqpoqqLnCzEC4mUZEQ3oXK3FiFegY/zlZjrjDRJir4aMoZCkGQqRAxME miaj4X7wNlGdvTaoZ3RN47VjTXQ/yzwZ+SLuXAwRZzDEi+oaKEEB0oWXTsa6Wope2Kv4 5tbux4VSOOwopMDe1Nqd8tT4BB+Aa5rQHlyUiREREj2/CoNr7FWViv4xM1lNEbhNEpab Vwtsm8YGYMTTB8nq9Z4P465VUN5U4HNyYYZ1aHZtlikSD8tX3OR8tri8tk5j2SwjX3BC ZHGUP5ZYrs3SnSS5/tqREPD5qLj79k3txCf2ZOjmR8cL+JeOVd/UQ0tbDI2GBr0nbsbY IOtw== X-Gm-Message-State: AOAM5336vf1svQa3xcHthotRIAE7JYnrEp2XKSkiQ50VHLf1SwevfsPI ZQcaEdmm9/SGVrSFn/DEb/GVmQKzUEfEO0lKRDc= X-Google-Smtp-Source: ABdhPJxCp23oKqgT7XXdhhdjEPu+OcUZASrDLwmZv4wMZcI65WgCtwMIVevq+CjU3mFCVa2OKYWWYQ== X-Received: by 2002:ac8:5d89:: with SMTP id d9mr695913qtx.49.1639706643538; Thu, 16 Dec 2021 18:04:03 -0800 (PST) Received: from localhost (c-73-125-89-242.hsd1.fl.comcast.net. [73.125.89.242]) by smtp.gmail.com with ESMTPSA id x16sm3913299qko.15.2021.12.16.18.04.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Dec 2021 18:04:03 -0800 (PST) From: Philip McGrath Date: Thu, 16 Dec 2021 21:02:44 -0500 Message-Id: <20211217020325.520821-5-philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211217020325.520821-1-philip@philipmcgrath.com> References: <20211213060107.129223-1-philip@philipmcgrath.com> <20211217020325.520821-1-philip@philipmcgrath.com> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * 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 3bd98c715e..51a393caab 100644 --- a/gnu/packages/node.scm +++ b/gnu/packages/node.scm @@ -261,7 +261,24 @@ (define-public node (find-files (search-input-directory outputs "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) @@ -822,4 +839,5 @@ (define-public libnode `(cons* "--shared" "--without-npm" ,flags)) ((#:phases phases '%standard-phases) `(modify-phases ,phases + (delete 'install-npmrc) (delete 'patch-nested-shebangs)))))))