Files
android-webview-kiosk/flake.nix
T
arnie b57e65f760
build / build (push) Has been cancelled
chore: upgrade toolchain to AGP 9.2.1 / Gradle 9 / nixpkgs 26.05
- nixpkgs 25.11 → 26.05; gradle_9 + jdk21; build-tools 35 → 36
- Drop custom gradle wrapper — GRADLE_OPTS works post-nixpkgs PR #449037
- AGP 8.7.3 → 9.2.1; Kotlin plugin removed (built-in since AGP 9)
- compileSdk/targetSdk 34 → 35; buildToolsVersion pinned to 36.0.0
- Java/Kotlin target 17 → 21; resValues feature flag required by AGP 9
- applicationVariants (removed in AGP 9) → androidComponents.onVariants
- Test task: testWeatherReleaseUnitTest → :app:test (all flavors, debug)
- CI artifact path fixed to cover all flavor APKs
- Docs: drop nix develop --command prefix (direnv activates shell)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-12 20:12:22 +02:00

70 lines
2.3 KiB
Nix

{
# android-webview-kiosk — Android TV fullscreen WebView kiosk showing a
# hardcoded Grafana dashboard, remote-launched via Sony Bravia IP control.
#
# Deviation from lab Go template: this flake provides a DEV SHELL ONLY.
# Gradle fetches Maven deps from the network, so the APK is built impurely:
# nix develop --command gradle :app:assembleRelease
# There is no `nix build` output and no container/push pipeline.
description = "Android TV fullscreen WebView kiosk for the Grafana house dashboard";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-26.05";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true; # Android SDK
android_sdk.accept_license = true;
};
};
buildToolsVersion = "36.0.0";
androidComposition = pkgs.androidenv.composeAndroidPackages {
platformVersions = [ "35" ];
buildToolsVersions = [ buildToolsVersion ];
includeEmulator = false;
includeSystemImages = false;
includeNDK = false;
};
androidSdk = androidComposition.androidsdk;
sdkRoot = "${androidSdk}/libexec/android-sdk";
fonts = with pkgs; [ noto-fonts dejavu_fonts freefont_ttf ];
in
{
devShells.default = pkgs.mkShell {
packages = [
androidSdk
pkgs.jdk21
pkgs.gradle_9
pkgs.imagemagick # banner/icon generation
pkgs.android-tools # adb for sideloading
] ++ fonts;
ANDROID_HOME = sdkRoot;
ANDROID_SDK_ROOT = sdkRoot;
JAVA_HOME = "${pkgs.jdk21}";
# NixOS gotcha: AGP downloads a dynamically-linked aapt2 from Maven
# that can't run on NixOS. Set android.aapt2FromMavenOverride via
# GRADLE_OPTS so AGP uses the SDK's aapt2 instead. Works since
# nixpkgs PR #449037 (merged post-25.11, present in 26.05+).
GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${sdkRoot}/build-tools/${buildToolsVersion}/aapt2";
FONTCONFIG_FILE = pkgs.makeFontsConf { fontDirectories = fonts; };
};
}
);
}