Add Nix flake: devShell + hermetic nonRoot debug APK build

- flake.nix: devShells.default (JDK 17 + Android SDK 34 / NDK 27.0.12077973 + Gradle)
  and packages.moonlight-android (assembleNonRootDebug via gradle mitmCache)
- deps.json: offline Maven lockfile (195 artifacts)
- nix-deps-fixup.gradle: skip androidTest variant ambiguity during dep capture
- README: Building with Nix section
This commit is contained in:
Oleks
2026-05-29 15:05:07 +03:00
parent f10085f552
commit d9dedf6f19
7 changed files with 990 additions and 1 deletions
+21
View File
@@ -0,0 +1,21 @@
// Workaround for the nixpkgs Gradle mitm-cache hook.
//
// The hook's `nixDownloadDeps` task force-resolves every resolvable configuration
// to record all dependencies. AGP's androidTest/test classpaths reference the app
// project itself and cannot disambiguate its published variants, so resolving them
// throws a "cannot choose between the following variants of project :app" error and
// aborts dependency capture.
//
// The hermetic build target is `assembleNonRootDebug`, which never compiles tests,
// so we mark every test configuration as non-resolvable. `nixDownloadDeps` filters
// on `canBeResolved`, so these are simply skipped, and the real build does not touch
// them either.
gradle.projectsLoaded {
rootProject.allprojects { proj ->
proj.afterEvaluate {
proj.configurations
.matching { it.name.toLowerCase().contains("test") }
.all { it.setCanBeResolved(false) }
}
}
}