From 15d77f998f85607b55051315ce2ecb1d023e2420 Mon Sep 17 00:00:00 2001 From: austinried <4966622+austinried@users.noreply.github.com> Date: Fri, 9 Oct 2026 09:08:33 +0000 Subject: [PATCH] build: drop the agent-specific gradle wrapper from the devshell The flock/nice/worker-cap wrapper serialised local builds to protect the shared box. That is now handled at the machine level (a GRADLE_OPTS cap in nix-home), so the devshell goes back to the plain nix Gradle. --- AGENTS.md | 1 - flake.nix | 24 +----------------------- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 99274e8a..5e3b046a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -14,7 +14,6 @@ Everything comes from the Nix flake devshell; do not install toolchains by hand. - The default devshell provides JDK 21, Gradle 9, the Android SDK (platform 37, build-tools 37.0.0, platform-tools 37.0.1) and nushell. - The integration harness needs real servers, so it lives in a separate `nix develop .#integration` shell (navidrome, gonic, lms, php, Nextcloud with the Music app, sqlite). Keeping them out of the default shell avoids pulling that closure into everyday builds. - Build with the devshell `gradle`, not `./gradlew`. CI uses the nix Gradle pinned by `flake.lock`; the wrapper is kept only for people without Nix. -- The devshell `gradle` is a wrapper: outside CI it takes a lock (under `$XDG_RUNTIME_DIR`, falling back to `~/.cache`) and runs under `nice` with a capped worker count, so several agents building at once queue instead of exhausting the box. `--stop`/`--status`/`--version` bypass the lock; with `CI` set it execs Gradle directly, unchanged. ## Commands diff --git a/flake.nix b/flake.nix index 391b6c41..6a76b535 100644 --- a/flake.nix +++ b/flake.nix @@ -40,31 +40,9 @@ }; androidSdk = android.androidsdk; - gradle_wrapper = pkgs.writeShellScriptBin "gradle" '' - if [ -n "''${CI:-}" ]; then - exec ${pkgs.gradle_9}/bin/gradle "$@" - fi - for arg in "$@"; do - case "$arg" in - -v | --version | --status | --stop) - exec ${pkgs.gradle_9}/bin/gradle "$@" - ;; - esac - done - runtime_dir="''${XDG_RUNTIME_DIR:-''${HOME:-/tmp}/.cache}" - mkdir -p "$runtime_dir" - lock="$runtime_dir/subtracks-gradle.lock" - if ! ${pkgs.util-linux}/bin/flock -n "$lock" ${pkgs.coreutils}/bin/true 2>/dev/null; then - echo "gradle: waiting for the build lock at $lock" >&2 - fi - export GRADLE_OPTS="''${GRADLE_OPTS:-} -Dorg.gradle.workers.max=4" - exec ${pkgs.util-linux}/bin/flock "$lock" \ - ${pkgs.coreutils}/bin/nice -n 10 ${pkgs.gradle_9}/bin/gradle "$@" - ''; - basePackages = [ pkgs.jdk21 - gradle_wrapper + pkgs.gradle_9 pkgs.git pkgs.curl pkgs.unzip