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-cloud-sdk: disable gce as a dependency by default (fixes #31369) #31709

Merged
merged 3 commits into from Nov 16, 2017

Conversation

1pakch
Copy link
Contributor

@1pakch 1pakch commented Nov 15, 2017

Motivation for this change

The commit b241bcf made google-compute-engine a dependency for google-cloud-sdk which make it impossible to build google-cloud-sdk on MacOS (#31679). In general, google-compute-engine is a package intended for GCE guest images and google-cloud-sdk needs google-compute-engine only when running on GCE.

This commit introduces a new attribute forGceInstance which controls whether google-compute-engine is included as a dependency and is false by default. Moreover, this commit includes the override for this package with forGceInstance set to true in the default NixOS configuration for GCE at nixos/modules/virtualisation/google-compute-image.nix.

Maintainers @stephenmw @zimbatm

Things done
  • Tested using sandboxing
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change
  • 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/)
  • Fits [CONTRIBUTING.md]

Copy link
Member

@zimbatm zimbatm left a comment

Choose a reason for hiding this comment

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

see inline comment

let
pythonInputs = [ cffi cryptography pyopenssl crcmod google-compute-engine ];
gcePackages = if forGceInstance then [ google-compute-engine ] else [];
pythonInputs = [ cffi cryptography pyopenssl crcmod ] ++ gcePackages;
Copy link
Member

Choose a reason for hiding this comment

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

I'd rather see [ cffi cryptography pyopenssl crcmod ] ++ lib.optional (!stdenv.isDarwin) google-compute-engine than introduce overrides and overlays. I don't think that the closure size matters that much in this context.

Copy link
Contributor Author

@1pakch 1pakch Nov 15, 2017

Choose a reason for hiding this comment

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

Well, in this case installing google-cloud-sdk from nixpkgs would install systemd libs as it is dependency to google-compute-engine. IMO, it is hardly a sane choice, especially for non-NixOS users.

Copy link
Contributor Author

@1pakch 1pakch Nov 15, 2017

Choose a reason for hiding this comment

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

I reiterate that the package google-compute-engine (coming from compute-image-packages repo) is only meant for GCE guests. Installing it everywhere just in case seems too much to me.

Copy link
Member

Choose a reason for hiding this comment

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

In that case let's make two top-level packages, google-cloud-sdk and google-cloud-sdk-gce. Changing the overlay of the GCE image profile seems a bit too much.

Copy link
Member

Choose a reason for hiding this comment

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

Can't we just add (google-cloud-sdk.override { gceClient = true; } into environment.systemPackages? I think that covers most of SDK usage without much complexity, and we can skip adding an additional package too (don't have a strong opinion here).

There are also potential users of SDK as a library like TensorFlow -- I think it supports transparently using Google Cloud Storage when it can find both google-cloud-sdk and google-cloud-engine but I didn't try that; let's leave this usecase be for a time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@abbradar If one puts overriden google-cloud-sdk in systemPackages it won't change the fact that all packages using google-cloud-sdk (e.g. TensorFlow) will use the default version (without gce).

An overlay for GCE would override the default version of google-cloud-sdk and this is exactly why I added it. The packages built against pkgs with this overlay (e.g. on a default NixOS GCE image) would then use gce-enabled google-cloud-sdk. The problem is that all packages that use google-cloud-sdk need to be built with two different versions of it if one want the binary cache to be available both on usual and GCE installations.

@1pakch
Copy link
Contributor Author

1pakch commented Nov 15, 2017 via email

@1pakch
Copy link
Contributor Author

1pakch commented Nov 16, 2017

I dropped the overlay and added a top level package with gce-enabled as per @zimbatm suggestion. The last commit adds the google-cloud-sdk-gce package to the top-level and Python packages and can be skipped if we don't want to introduce new packages.

@1pakch
Copy link
Contributor Author

1pakch commented Nov 16, 2017

BTW, I rewrote the history in my private branch so the initial PR is not reachable. Is that OK, or it would have been better to revert?

@zimbatm zimbatm merged commit 2d95a6a into NixOS:master Nov 16, 2017
@zimbatm
Copy link
Member

zimbatm commented Nov 16, 2017

Thanks @ilya-kolpakov !

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

4 participants