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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

android-studio-full: init #315233

Merged
merged 5 commits into from
Jun 16, 2024
Merged

android-studio-full: init #315233

merged 5 commits into from
Jun 16, 2024

Conversation

numinit
Copy link
Contributor

@numinit numinit commented May 28, 2024

Description of changes

Create the following APIs that bridge the gap between Android Studio and androidenv:

  • androidStudioPackages.<flavor>.withSdk: Wraps Android Studio in an Android SDK created with androidenv. Exports ANDROID_SDK_ROOT and ANDROID_NDK_ROOT to the environment of the Android Studio process, if detected. This makes new projects default to the androidenv composition instead of needing to download SDKs separately, which causes emulators to break with dynamic linker errors when users try to run Android Studio out of the box on nixpkgs. Since androidenv already solves this problem, this improves the out of the box experience with Android Studio in nixpkgs.
  • androidStudioPackages.<flavor>.full: Wraps Android Studio in a default "full" SDK composition
  • android-studio-full: Alias for android-studio.full

Remove the following old androidenv composition:

  • androidenv.androidPkgs_9_0

Add the following new androidenv composition:

  • androidenv.androidPkgs

We should probably discuss this API change since it downloads a ton of Android system images, but is a way to have a relatively "full" version of androidPkgs.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 馃憤 reaction to pull requests you find important.

@numinit
Copy link
Contributor Author

numinit commented May 28, 2024

cc: @hadilq @jakubgs

@hadilq
Copy link
Contributor

hadilq commented May 28, 2024

It looks awesome. Thanks

@alapshin
Copy link
Contributor

Agree, this looks great. Looking forward to getting it merged

@numinit
Copy link
Contributor Author

numinit commented May 29, 2024

For some reason AS is really stupid about not automatically populating ANDROID_SDK_ROOT automatically everywhere. Projects created will use it though.

Example

image

@numinit numinit force-pushed the android-studio-full branch 3 times, most recently from dd91a55 to d15bfef Compare May 29, 2024 07:43
@ofborg ofborg bot requested a review from alapshin May 29, 2024 08:18
@JohnRTitor JohnRTitor requested a review from alyssais May 31, 2024 20:08
Rename androidPkgs_9_0 to androidPkgs, and treat it more like a "full"
androidenv package.
This package provides Android Studio with a relatively complete
set of SDK and emulator packages.
Copy link
Contributor

@jakubgs jakubgs left a comment

Choose a reason for hiding this comment

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

Good stuff.

@numinit
Copy link
Contributor Author

numinit commented Jun 6, 2024

A user on the Discord had a problem running the emulator from Android Studio, and it required the unnecessarily complicated solution of instantiating androidenv separately and writing out the local.properties with sdk.dir set. It was so close that I realized we could just wrap it and get the best of both worlds.

It's 100% worth observing how newbies to Nix use our stuff. After a couple hours of going back and forth, the use case was glaringly obvious.

@JohnRTitor JohnRTitor requested a review from wegank June 8, 2024 07:20
@numinit
Copy link
Contributor Author

numinit commented Jun 9, 2024

Only thing I'm not sure about is the changelog, which may require a manual merge.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-already-reviewed/2617/1727

@numinit numinit mentioned this pull request Jun 9, 2024
5 tasks
@drupol drupol merged commit 4b2ef8f into NixOS:master Jun 16, 2024
29 checks passed
Copy link
Contributor

Successfully created backport PR for release-24.05:

@numinit
Copy link
Contributor Author

numinit commented Jun 16, 2024

Changelog fixed in #320194

@numinit numinit removed the backport release-24.05 Backport PR automatically label Jun 16, 2024
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

9 participants