makes icon indicating copy to clipboard operation
makes copied to clipboard

Support nodejs modules from github

Open dacevedo12 opened this issue 3 years ago • 1 comments

npm supports installing directly from github repos, which comes in handy as sometimes, maintainers take a long time to publish new versions to npm

perhaps the structure in the package-lock changes a bit, causing makes to fail when installing the deps

image

error: attribute 'integrity' missing

       at /nix/store/hawaw7ivjjrq228iak21lvcjq7nxpax2-source/src/args/make-node-js-modules/default.nix:77:34:

           76|               value = {
           77|                 dist.integrity = versionAttrs.integrity;
             |                                  ^
           78|                 dist.tarball = versionAttrs.resolvedName;

       … while evaluating anonymous lambda

       at /nix/store/hawaw7ivjjrq228iak21lvcjq7nxpax2-source/src/args/make-derivation/default.nix:27:9:

           26|     builtins.mapAttrs
           27|     (k: v: (
             |         ^
           28|       if (hasPrefix "__" k) || (hasPrefix "env" k)

       … from call site

       … while evaluating the attribute 'envAll' of the derivation 'gatsby-source-cloudinary.json'

       at /nix/store/hawaw7ivjjrq228iak21lvcjq7nxpax2-source/src/args/make-derivation/default.nix:92:7:

           91|       builder = "${__nixpkgs__.bash}/bin/bash";
           92|       name = toDerivationName name;
             |       ^
           93|       outputs = ["out"];

       … while evaluating 'escapeShellArg'

Tested with npm i --save https://github.com/cloudinary-devs/gatsby-source-cloudinary#19a2115fdf876c55ff74756e6dfd8d775bad636c

dacevedo12 avatar Jun 22 '22 14:06 dacevedo12

note: It works well using the tar.gz npm i --save https://github.com/cloudinary-devs/gatsby-source-cloudinary/archive/19a2115fdf876c55ff74756e6dfd8d775bad636c.tar.gz

npm supports both, so it would be worth documenting this behavior in case this becomes a won't fix

dacevedo12 avatar Jun 22 '22 15:06 dacevedo12

@dacevedo12 As we recently migrated to node2nix, it would be nice to tests if this works now.

dsalaza4 avatar Jan 19 '24 21:01 dsalaza4

Seems node2nix is capable of it, but it doesn't find the git binary


error: builder for '...' failed with exit code 1;
       last 10 log lines:
       >   code: 'ENOENT',
       >   syscall: 'spawn git',
       >   path: 'git',
       >   spawnargs: [
       >     'clone',
       >     'ssh://[email protected]/cloudinary-devs/gatsby-source-cloudinary.git'
       >   ]
       > }
       >
       > Node.js v20.10.0

dacevedo12 avatar Jan 30 '24 17:01 dacevedo12

@dacevedo12

Maybe by adding buildInputs via packageOverrides as shown here

dsalaza4 avatar Jan 30 '24 17:01 dsalaza4

It only worked at makes level (make-node-js-modules/default.nix), by adding __nixpkgs__.git

git via ssh doesn't work but that's a limitation from node2nix https://github.com/svanderburg/node2nix/issues/309

git via https works fine with the aforementioned patch

dacevedo12 avatar Jan 30 '24 18:01 dacevedo12

@dacevedo12 A PR adding git to the builtin is welcome!

dsalaza4 avatar Jan 30 '24 18:01 dsalaza4

Addressed in https://github.com/fluidattacks/makes/pull/1286

Thanks @dsalaza4 node2nix sure was an improvement!

dacevedo12 avatar Jan 30 '24 19:01 dacevedo12