Skip to content

Commit

Permalink
fix android developmetn environment
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeisnt committed Jan 27, 2023
1 parent d5d3987 commit bb68b72
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Started as a fork of [hlissner's dotfiles](https://github.com/hlissner/dotfiles)
<img src="/../screenshots/nordic/sway-1.jpg" width="100%" />
<img src="/../screenshots/nordic/sway-2.jpg" width="100%" />

Feel free to poke around and contact me if you have any questions : )
Feel free to poke around. Contact me if you have any questions!

## Installation

Expand Down
3 changes: 2 additions & 1 deletion hosts/work/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@
};
};
dev = {
clojure.enable = true;
clojure.enable = true;
android.enable = true;
};
hardware = {
audio.enable = true;
Expand Down
32 changes: 20 additions & 12 deletions modules/dev/android.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ in {

config = mkIf cfg.enable {
user.packages = with pkgs; [
android-studio
# use the development version of android-studio (needed for StreetComplete)
androidStudioPackages.dev
androidSdk
platformTools
glibc
Expand All @@ -20,18 +21,25 @@ in {
programs.adb.enable = true;
user.extraGroups = [ "adbusers" ];
services.udev.packages = [ pkgs.android-udev-rules ];
environment.variables.ANDROID_JAVA_HOME = "${pkgs.openjdk8.home}";
environment.variables.ANDROID_SDK_ROOT = "${androidSdk}";
environment.variables.GRADLE_OPTS =
"-Dorg.gradle.project.android.aapt2FromMavenOverride=${androidSdk}/libexec/android-sdk/build-tools/28.0.3/aapt2";
# https://github.com/swaywm/sway/issues/595
environment.variables._JAVA_AWT_WM_NONREPARENTING = "1";

env.ANDROID_JAVA_HOME = "${pkgs.openjdk8.home}";
env.ANDROID_SDK_ROOT = "${androidSdk}";
environment.variables = {
ANDROID_JAVA_HOME = "${pkgs.openjdk8.home}";
ANDROID_SDK_ROOT = "${androidSdk}";
GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${androidSdk}/libexec/android-sdk/build-tools/28.0.3/aapt2";
# Increase max memory sizes for gradle builds
JAVA_OPTIONS = "-Xms1024m -Xmx4096m";
# https://github.com/swaywm/sway/issues/595
_JAVA_AWT_WM_NONREPARENTING = "1";
};

# override the aapt2 that gradle uses with the nix-shipped version
env.GRADLE_OPTS =
"-Dorg.gradle.project.android.aapt2FromMavenOverride=${androidSdk}/libexec/android-sdk/build-tools/28.0.3/aapt2";
# TODO: Redundant?
env = {
ANDROID_JAVA_HOME = "${pkgs.openjdk8.home}";
ANDROID_SDK_ROOT = "${androidSdk}";

# override the aapt2 that gradle uses with the nix-shipped version
GRADLE_OPTS =
"-Dorg.gradle.project.android.aapt2FromMavenOverride=${androidSdk}/libexec/android-sdk/build-tools/28.0.3/aapt2";
};
};
}

0 comments on commit bb68b72

Please sign in to comment.