Open theotheroracle opened 3 months ago
Thanks for this! while I'm interested in nix i'm not really sure if I want to merge right now as I dont have any necessary experience to provide support in this area. If someone is able to provide support in maintaining this side of things that would be cool, because I think it would be sweet to eventually have official support for this
i will personally be maintaining it, so if there's ever any issues with it, i'll take care of it
I got a more comprehensive one that sets up Android CLI compilation as well
flake.nix
{
description = "Flutter Development Environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
config = {
android_sdk.accept_license = true;
allowUnfree = true;
};
};
aapt2buildToolsVersion = "34.0.0";
androidComposition = pkgs.androidenv.composeAndroidPackages {
buildToolsVersions = [
"30.0.3"
aapt2buildToolsVersion
];
platformVersions = [
"28"
"29"
"30"
"31"
"32"
"33"
"34"
];
includeNDK = true;
ndkVersions = [ "21.4.7075529" ];
cmakeVersions = [ "3.18.1" ];
abiVersions = [
"armeabi-v7a"
"arm64-v8a"
];
};
androidSdk = androidComposition.androidsdk;
in
{
devShell =
with pkgs;
mkShell rec {
ANDROID_SDK_ROOT = "${androidSdk}/libexec/android-sdk";
ANDROID_JAVA_HOME = jdk17.home;
JAVA_8_HOME = jdk8.home;
JAVA_17_HOME = jdk17.home;
GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${ANDROID_SDK_ROOT}/build-tools/${aapt2buildToolsVersion}/aapt2";
buildInputs = [
flutter
androidSdk
jdk17
];
};
}
);
}
.envrc
use flake
This was the best I could come up with, no idea if you can convince Gradle to not download Java without this line
commet/android/gradle.properties
+ org.gradle.java.installations.fromEnv=JAVA_8_HOME,JAVA_17_HOME
one thing to note, is that i couldn't only get the cmdline tools, which flutter doctor complains about, without using openjdk8, i have no idea why modern versions weren't working
There's a dependency that requires JDK8, you need both for it to compile. I have it solved in my flake.
if you open a pr for your flake I'll close mine
don't need to merge, just thought i'd offer since i set it up