From patchwork Mon Dec 13 06:00:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 35158 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 B72C527BBE9; Mon, 13 Dec 2021 06:03:31 +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=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,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 9A92C27BBEA for ; Mon, 13 Dec 2021 06:03:30 +0000 (GMT) Received: from localhost ([::1]:40084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mweQr-0001J5-IN for patchwork@mira.cbaines.net; Mon, 13 Dec 2021 01:03:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40696) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mweQR-0000pd-S5 for guix-patches@gnu.org; Mon, 13 Dec 2021 01:03:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:42159) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mweQR-00074p-IV for guix-patches@gnu.org; Mon, 13 Dec 2021 01:03:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mweQR-0002RZ-F0 for guix-patches@gnu.org; Mon, 13 Dec 2021 01:03:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51838] [PATCH v4 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: Mon, 13 Dec 2021 06:03:03 +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.16393753659283 (code B ref 51838); Mon, 13 Dec 2021 06:03:03 +0000 Received: (at 51838) by debbugs.gnu.org; 13 Dec 2021 06:02:45 +0000 Received: from localhost ([127.0.0.1]:53688 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mweQ8-0002Pf-LI for submit@debbugs.gnu.org; Mon, 13 Dec 2021 01:02:44 -0500 Received: from mail-ua1-f45.google.com ([209.85.222.45]:35738) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mweQ5-0002PE-GD for 51838@debbugs.gnu.org; Mon, 13 Dec 2021 01:02:42 -0500 Received: by mail-ua1-f45.google.com with SMTP id l24so27361166uak.2 for <51838@debbugs.gnu.org>; Sun, 12 Dec 2021 22:02:41 -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=oMJBdwZ4+Xn21yGOr6RykspdCfJ7NdoBqQsI1LH/rLk=; b=WdOp41oMYvsBwTUTW2LNrgHvGiXZBSKg29/mSB5WHhHNB/+6UaXDSpWeFYx9BQJcTs 93lnKEy9iw722yKG5ppWaYS7kpOihMkGatKIV6io6F3vBO7bPmBrqqXlF4907NunBFae jpqPwfKV2vFP4tQ6AIg6WUvCgeIL0nQl/jByEDmkkuSuPnxoRQZepyzklWgIH+fFjGrV cMZKRZtWQSvh/2FYNASQFZlfov5nb57E3hia2+5O4YOfLFshdSOoXYtFs75L9ZwsHpUt Fo56y4i7ZnNQ07N8UcfnSSR4LRdrNp9dnbtJ0g0Cnv+0Mde13mLeFVh/tKPt/ISDhLHO bAAQ== 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=oMJBdwZ4+Xn21yGOr6RykspdCfJ7NdoBqQsI1LH/rLk=; b=7fUS09Gjm8GtJzywJY4AIEGKnM9CgEhf0MBG3igBGXrXIwjHo0lLt03XHcf7wxlgnd N0zNX58SxlG/1OYnJpWBVPLYFXnDLTTko+aEfvrVf9EgDK3R/KGanM/Vhaq1Sb2ENc5Q z+SsHWVRiW4usNWie8d+Dx8mshoUe2AtcWEBUfmh+Vxp3yO75ouxxIMfELFcQ7kk8Nk1 c4BcaiK8IDQwjJu8j4N4FD5pqeVJMXYeQ1Q4WPwlKSZiDrs9RT8KWJ7gKTzO7bBszOaR ZzuKQO9x6b/B2arb1KBeVVhcDQLCuZlvfqQPqPgEhShWyxIavpjUZ6uh6jHw9NPUQ92v /NIA== X-Gm-Message-State: AOAM532D4uIQ3cAhwGD5/6wMAnacNIyRip65tQKwofnqqx3aDrzNdyK9 lMKCTvpA/HYKCd35xCqdg/NsQWxwWyN08Hgoi58= X-Google-Smtp-Source: ABdhPJwraxH+4DXzcohl/mBEuYq7EBQPUpo2Rj1xBxZxtCjGl5veq6ltZuD+fr1vIUxfQlbKUF5jhw== X-Received: by 2002:a67:1ac1:: with SMTP id a184mr24057470vsa.22.1639375355970; Sun, 12 Dec 2021 22:02:35 -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 92sm3759120uar.19.2021.12.12.22.02.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 12 Dec 2021 22:02:35 -0800 (PST) From: Philip McGrath Date: Mon, 13 Dec 2021 01:00:26 -0500 Message-Id: <20211213060107.129223-5-philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211213060107.129223-1-philip@philipmcgrath.com> References: <46a042bc08eb72a068b1e8c69bfe28cf2d4b2e53.camel@gmail.com> <20211208202838.752542-1-philip@philipmcgrath.com> <20211208202838.752542-5-philip@philipmcgrath.com> <877dc924h7.fsf@gmx.com> <5c62c3ce-dd50-5dcd-00ed-ff1524be4e0b@philipmcgrath.com> <20211213060107.129223-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 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)))))))