Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google clasp #43376

Merged
merged 2 commits into from Aug 22, 2019
Merged

Google clasp #43376

merged 2 commits into from Aug 22, 2019

Conversation

michojel
Copy link
Contributor

Motivation for this change

Upstream's github page says it all:

🗺️ Develop Locally: clasp allows you to develop your Apps Script projects locally. That means you can check-in your code into source control, collaborate with other developers, and use your favorite tools to develop Apps Script.

🔢 Manage Deployment Versions: Create, update, and view your multiple deployments of your project.

📁 Structure Code: clasp automatically converts your flat project on script.google.com into folders.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

@michojel
Copy link
Contributor Author

Rebased.

Not sure whom to ping. @svanderburg would you be so kind to take a look or perhaps suggest another reviewer?
Note: this is my first contribution to NixOs.
Thanks!

@mmahut
Copy link
Member

mmahut commented Aug 7, 2019

Any updates on this pull request, please?

@michojel
Copy link
Contributor Author

michojel commented Aug 8, 2019

Resurrected, but do not merge yet. Need to resolve a TypeError first:

clasp --version
/nix/store/q90cs1sqmjhg2sdksqal5qpyryag9hhs-node-_at_google_slash_clasp-2.2.1/lib/node_modules/@google/clasp/src/dotfile.js:97
    RC: dotf(exports.DOT.RC.DIR, exports.DOT.RC.NAME),
        ^

TypeError: dotf is not a function
    at Object.<anonymous> (/nix/store/q90cs1sqmjhg2sdksqal5qpyryag9hhs-node-_at_google_slash_clasp-2.2.1/lib/node_modules/@google/clasp/src/dotfile.js:97:9)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/nix/store/q90cs1sqmjhg2sdksqal5qpyryag9hhs-node-_at_google_slash_clasp-2.2.1/lib/node_modules/@google/clasp/src/utils.js:52:17)
    at Module._compile (internal/modules/cjs/loader.js:701:30)

@michojel michojel force-pushed the google-clasp branch 2 times, most recently from a2d7e1b to 9485df1 Compare August 18, 2019 08:38
Useful for developing Google's Apps Scripts.

Signed-off-by: Michal Minář <mic.liamg@gmail.com>
@michojel
Copy link
Contributor Author

Resurrected, but do not merge yet. Need to resolve a TypeError first:

Fixed by a patch.

@turboMaCk, @domenkozar PTAL (adding people having some experience with node packages, feel free to tag others)

Signed-off-by: Michal Minář <mic.liamg@gmail.com>
Copy link
Member

@turboMaCk turboMaCk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a commiter btw so just a review.

  • builds and runs on NixOS
  • builds and runs on MacOS

I've found 2 minor things in the diff I'm unsure about but that's for someone more experienced to decide. I don't think either is a blocker for merge.

I would recommend squishing commits before merge.

})."@google/clasp-${version}".override rec {
preRebuild = ''
patch -p1 <<<"${builtins.readFile ./dotf.patch}"
'';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure but there might be hook patches to which you can just simply list files. But I don't think I ever used it in case of node2nix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @turboMaCk. The unpacking of node packages takes place in the installPhase:

checking outputs of '/nix/store/bd9fs5z96ypszcn0zqmh9lp2l29m51sp-node-_at_google_slash_clasp-2.2.1.drv'...                                                                  
unpacking sources                                                                                                                                                            
patching sources                                                                                                                                                             
configuring                                                                                                                                                                 
no configure script, doing nothing                                                                                                                                           
building                                                                                                                                                                     
installing                                                                                                                                                                   
unpacking source archive /nix/store/xzbw3n2j4zq5nh1j4dkx0aqn1mr629lp-clasp-2.2.1.tgz                                                                                         
unpacking source archive /nix/store/ibwdid42ly8x7xidcvp0jr7jnnm281lf-fs.scandir-2.1.1.tgz                                                                                    
unpacking source archive /nix/store/zfpb0hszl9827qmhbkhy3sksrlyfnja0-fs.stat-2.0.1.tgz                                                                                       
unpacking source archive /nix/store/33qz58lq0f86hcbdi13jp04ndwp4c824-fs.walk-1.2.2.tgz                                                                               
...

The patchPhase does not have the sources available yet.

The nodePackages seem to patch the sources during in the preBuild phase:

So this can be inconsistent either with a regular nix package build or node-package build. An alternative approach to this would be:

  1. list the package in node-packages-v10.json
  2. add another override like (pnpm = nodePackages.pnpm.override) in the default-v10.nix

I don't have a strong opinion on this one.

@adisbladis toughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was playing with this and I think the solution you come up with is fine and most straight forward at the moment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine for now. However I'd like to refresh my knowledge about the node2nix codebase first to check if there's a proper workaround (otherwise I'd file an issue there later).

exec node2nix --nodejs-10 \
-i node-packages.json -o node-packages.nix \
-c google-clasp.nix \
--no-copy-node-env -e ../../../development/node-packages/node-env.nix
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if it's preferable to share node-env file this way or not. Can anyone more experienced clarify this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two other occurrences:

From my point of view, the less redundancy, the better.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for references. My thinking was that this creates non obvious coupling between what appears as unrelated modules. Anyway this is not really up to me to decide so unless someone more experienced comes in and gives definite answer I would keep it as is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC we use a single node2nix in nixpkgs (hence the same node-env.nix) for everything, so this should be fine IMHO.
In the end we already have a lot of large diffs because of that, so I'd prefer to use the node-env.nix we already have unless we encounter issues that can be resolved by committing another one : )

@turboMaCk
Copy link
Member

@GrahamcOfBorg build google-clasp

@michojel
Copy link
Contributor Author

@Ma27 could you please take a look?

@Ma27
Copy link
Member

Ma27 commented Aug 20, 2019

After skimming through the diff, this appears to be fine. Before merging, I'd love to test this first. I'll probably be able to do this tonight, as soon as I have a better uplink to download all needed dependencies :)

Copy link
Member

@Ma27 Ma27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Unless there are further objections, I'd merge tomorrow :)

@Ma27 Ma27 merged commit f0c12c4 into NixOS:master Aug 22, 2019
@michojel
Copy link
Contributor Author

Thanks @Ma27 and @turboMaCk!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants