diff mbox series

[bug#51838,v3,26/43] gnu: Add node-nan.

Message ID 20211208202838.752542-27-philip@philipmcgrath.com
State Accepted
Headers show
Series guix: node-build-system: Support compiling add-ons with node-gyp. | expand

Commit Message

Philip McGrath Dec. 8, 2021, 8:28 p.m. UTC
* gnu/packages/node-xyz.scm (node-nan): New variable.
---
 gnu/packages/node-xyz.scm | 44 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

Comments

Pierre Langlois Dec. 12, 2021, 4:17 p.m. UTC | #1
Philip McGrath <philip@philipmcgrath.com> writes:

> * gnu/packages/node-xyz.scm (node-nan): New variable.
> ---
>  gnu/packages/node-xyz.scm | 44 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 44 insertions(+)
>
> diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
> index 3e06413908..ed169c0778 100644
> --- a/gnu/packages/node-xyz.scm
> +++ b/gnu/packages/node-xyz.scm
> @@ -553,3 +553,47 @@ (define-public node-irc
>      (description "@code{node-irc} is an IRC client library for Node.js.
>  It has functions for joining, parting, talking, and many other IRC commands.")
>      (license license:gpl3+)))
> +
> +(define-public node-nan
> +  (package
> +    (name "node-nan")
> +    (version "2.15.0")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/nodejs/nan")
> +             (commit (string-append "v" version))))
> +       (file-name (git-file-name name version))
> +       (sha256
> +        (base32 "18xslh9va5ld872scrp5y4251ax9s3c6qh0lnl1200lpzbsxy7yd"))))
> +    (build-system node-build-system)
> +    (arguments
> +     `(#:tests?
> +       ;; tests need tap and other dependencies
> +       #f

Formatting nit, you can write this all in one line:

    #:tests? #f  ;; Tests need tap an other dependencies.

> +       #:absent-dependencies
> +       '("bindings"
> +         "commander"
> +         "glob"
> +         "request"
> +         "node-gyp" ;; would be needed for tests
> +         "tap"
> +         "xtend")))
> +    (inputs
> +     `(("readable-stream" ,node-readable-stream)))
> +    (home-page "https://github.com/nodejs/nan")
> +    (synopsis "Native Abstractions for Node.js")
> +    (description "A header file filled with macro and utility goodness for
> +making add-on development for Node.js easier across versions 0.8, 0.10, 0.12,
> +1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 and 16.

Given our packages only work with the node what Guix uses, you could
remove the version numbers from the description. Mostly because we
probalby won't think to update this description when future node
releases appear.

> +
> +Thanks to the crazy changes in V8 (and some in Node core), keeping native
> +addons compiling happily across versions, particularly 0.10 to 0.12 to 4.0, is
> +a minor nightmare.

I'd remove this sentence, it doesn't make much sense in Guix given we
don't support older versions.

> +The goal of this project is to store all logic necessary
> +to develop native Node.js addons without having to inspect
> +@code{NODE_MODULE_VERSION} and get yourself into a macro-tangle.
> +
> +This project also contains some helper utilities that make addon development a
> +bit more pleasant.")
> +    (license license:expat)))

Otherwise LGTM! I hope my comments make sense, I agree in general it's
good to keep our description the same as upstream. But I think it's OK
to reserve ourselves the right to tweak them a little bit, after all we
provide a "curated" set of packages, not a direct mirror IMO :-).

Thanks,
Pierre
Philip McGrath Dec. 12, 2021, 9:33 p.m. UTC | #2
On 12/12/21 11:17, Pierre Langlois wrote:
> 
> Philip McGrath <philip@philipmcgrath.com> writes:
> 
>> * gnu/packages/node-xyz.scm (node-nan): New variable.
>> ---
>>   gnu/packages/node-xyz.scm | 44 +++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 44 insertions(+)
>>
>> diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
>> index 3e06413908..ed169c0778 100644
>> --- a/gnu/packages/node-xyz.scm
>> +++ b/gnu/packages/node-xyz.scm
>> @@ -553,3 +553,47 @@ (define-public node-irc
>>       (description "@code{node-irc} is an IRC client library for Node.js.
>>   It has functions for joining, parting, talking, and many other IRC commands.")
>>       (license license:gpl3+)))
>> +
>> +(define-public node-nan
>> +  (package
>> +    (name "node-nan")
>> +    (version "2.15.0")
>> +    (source
>> +     (origin
>> +       (method git-fetch)
>> +       (uri (git-reference
>> +             (url "https://github.com/nodejs/nan")
>> +             (commit (string-append "v" version))))
>> +       (file-name (git-file-name name version))
>> +       (sha256
>> +        (base32 "18xslh9va5ld872scrp5y4251ax9s3c6qh0lnl1200lpzbsxy7yd"))))
>> +    (build-system node-build-system)
>> +    (arguments
>> +     `(#:tests?
>> +       ;; tests need tap and other dependencies
>> +       #f
> 
> Formatting nit, you can write this all in one line:
> 
>      #:tests? #f  ;; Tests need tap an other dependencies.

Yes, I'll do that. It causes problems for automatic indentation if it's 
the first line, but I can put it after #:absent-dependencies, as I 
started doing elsewhere.

> 
>> +       #:absent-dependencies
>> +       '("bindings"
>> +         "commander"
>> +         "glob"
>> +         "request"
>> +         "node-gyp" ;; would be needed for tests
>> +         "tap"
>> +         "xtend")))
>> +    (inputs
>> +     `(("readable-stream" ,node-readable-stream)))
>> +    (home-page "https://github.com/nodejs/nan")
>> +    (synopsis "Native Abstractions for Node.js")
>> +    (description "A header file filled with macro and utility goodness for
>> +making add-on development for Node.js easier across versions 0.8, 0.10, 0.12,
>> +1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 and 16.
> 
> Given our packages only work with the node what Guix uses, you could
> remove the version numbers from the description. Mostly because we
> probalby won't think to update this description when future node
> releases appear.
> 
>> +
>> +Thanks to the crazy changes in V8 (and some in Node core), keeping native
>> +addons compiling happily across versions, particularly 0.10 to 0.12 to 4.0, is
>> +a minor nightmare.
> 
> I'd remove this sentence, it doesn't make much sense in Guix given we
> don't support older versions.

Both of these seem like good changes to me. (Personally, I think a lot 
of complexity in JavaScript land comes from trying to support obsolete 
versions of things.)

-Philip
diff mbox series

Patch

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 3e06413908..ed169c0778 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -553,3 +553,47 @@  (define-public node-irc
     (description "@code{node-irc} is an IRC client library for Node.js.
 It has functions for joining, parting, talking, and many other IRC commands.")
     (license license:gpl3+)))
+
+(define-public node-nan
+  (package
+    (name "node-nan")
+    (version "2.15.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/nan")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "18xslh9va5ld872scrp5y4251ax9s3c6qh0lnl1200lpzbsxy7yd"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:tests?
+       ;; tests need tap and other dependencies
+       #f
+       #:absent-dependencies
+       '("bindings"
+         "commander"
+         "glob"
+         "request"
+         "node-gyp" ;; would be needed for tests
+         "tap"
+         "xtend")))
+    (inputs
+     `(("readable-stream" ,node-readable-stream)))
+    (home-page "https://github.com/nodejs/nan")
+    (synopsis "Native Abstractions for Node.js")
+    (description "A header file filled with macro and utility goodness for
+making add-on development for Node.js easier across versions 0.8, 0.10, 0.12,
+1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 and 16.
+
+Thanks to the crazy changes in V8 (and some in Node core), keeping native
+addons compiling happily across versions, particularly 0.10 to 0.12 to 4.0, is
+a minor nightmare.  The goal of this project is to store all logic necessary
+to develop native Node.js addons without having to inspect
+@code{NODE_MODULE_VERSION} and get yourself into a macro-tangle.
+
+This project also contains some helper utilities that make addon development a
+bit more pleasant.")
+    (license license:expat)))