{
description = "Flutter 3.13.x";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
android-nixpkgs = {
url = "github:tadfisher/android-nixpkgs";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
android-nixpkgs,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
# config = {
# android_sdk.accept_license = true;
# allowUnfree = true;
# };
};
android-pkgs = import android-nixpkgs {
inherit system;
};
jdk-custom = pkgs.jdk17;
android-sdk-custom = android-pkgs.sdk (sdkPkgs:
with sdkPkgs; [
# List options: `nix flake show github:tadfisher/android-nixpkgs`
cmdline-tools-latest
build-tools-34-0-0
platform-tools
platforms-android-34
system-images-android-24-google-apis-x86
emulator
]);
in {
devShell = with pkgs;
mkShell rec {
JAVA_HOME = jdk-custom;
# ANDROID_HOME = "${android-sdk-custom}/share/android-sdk";
# ANDROID_SDK_HOME = "${android-sdk-custom}/share/android-sdk"; # Deprecated Use ANDROID_HOME instead
# ANDROID_SDK_ROOT = "${android-sdk-custom}/share/android-sdk";
# ANDROID_SDK_ROOT = "${android-sdk-custom}/libexec/android-sdk";
CHROME_EXECUTABLE = "${pkgs.chromium}/bin/chromium";
buildInputs = [
flutter
android-sdk-custom
jdk-custom
gradle
];
};
});
}
[nixos@enka:~/src/sanri]$ flutter run
Launching lib/main.dart on Android SDK built for x86 in debug mode...
You are applying Flutter's app_plugin_loader Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply
Checking the license for package Android SDK Tools in /nix/store/kka24f9gjg4v3m3mr06lm2ynk3ns6pwv-android-sdk-env/share/android-sdk/licenses
License for package Android SDK Tools accepted.
Preparing "Install Android SDK Tools (revision: 26.1.1)".
Warning: Failed to read or create install properties file.
Checking the license for package Android SDK Build-Tools 30.0.3 in /nix/store/kka24f9gjg4v3m3mr06lm2ynk3ns6pwv-android-sdk-env/share/android-sdk/licenses
License for package Android SDK Build-Tools 30.0.3 accepted.
Preparing "Install Android SDK Build-Tools 30.0.3 (revision: 30.0.3)".
Warning: Failed to read or create install properties file.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to install the following SDK components:
tools Android SDK Tools
build-tools;30.0.3 Android SDK Build-Tools 30.0.3
- The SDK directory is not writable (/nix/store/kka24f9gjg4v3m3mr06lm2ynk3ns6pwv-android-sdk-env/share/android-sdk)
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
Running Gradle task 'assembleDebug'... 1,587ms
Error: Gradle task assembleDebug failed with exit code 1