diff --git a/flake.nix b/flake.nix index 88a42a3a..6a57fb96 100644 --- a/flake.nix +++ b/flake.nix @@ -76,8 +76,9 @@ ANDROID_SDK_ROOT = "${androidSdk}/libexec/android-sdk"; JAVA_HOME = "${pkgs.jdk21}"; - # Gradle needs a writable home - GRADLE_USER_HOME = "$PWD/.gradle-home"; + # GRADLE_USER_HOME stays at the default ~/.gradle: Nix attrs are not + # shell-expanded, so "$PWD/..." gave every checkout and worktree its + # own cache and daemon pool, and idle daemons piled up in RAM. shellHook = '' echo " HermesControl Android dev shell" @@ -90,9 +91,6 @@ # Ensure Android CLI tools and local user binaries are on PATH export PATH="$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator:$HOME/.local/bin:$PATH" - # Writable gradle home - mkdir -p "$GRADLE_USER_HOME" - # Enable host keyboard input for the project's existing AVD. hermesAvdConfig="''${ANDROID_AVD_HOME:-''${ANDROID_USER_HOME:-$HOME/.android}/avd}/hermes_dev.avd/config.ini" if [ -f "$hermesAvdConfig" ]; then diff --git a/gradle.properties b/gradle.properties index 32d72a93..76cd1e6a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,6 +7,8 @@ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +# Stop idle daemons after 20 min (default 3 h) so finished builds release their RAM. +org.gradle.daemon.idletimeout=1200000 # Enables Gradle Build Cache. # See https://docs.gradle.org/current/userguide/build_cache.html org.gradle.caching=true