diff --git a/ltx_flutter/android/app/build.gradle b/ltx_flutter/android/app/build.gradle index 132b8dd..d3d845f 100644 --- a/ltx_flutter/android/app/build.gradle +++ b/ltx_flutter/android/app/build.gradle @@ -48,7 +48,7 @@ android { applicationId "com.ryanpandya.lifetracker" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. - minSdkVersion flutter.minSdkVersion + minSdkVersion 19 //flutter.minSdkVersion targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName diff --git a/ltx_flutter/flake.lock b/ltx_flutter/flake.lock index b5966a1..f168f6f 100644 --- a/ltx_flutter/flake.lock +++ b/ltx_flutter/flake.lock @@ -1,8 +1,68 @@ { "nodes": { + "android-nixpkgs": { + "inputs": { + "devshell": "devshell", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1695500385, + "narHash": "sha256-bpTF7H5fjfZMwgU8/W28FPgkyTf2rYTVUMBgmMskk44=", + "owner": "tadfisher", + "repo": "android-nixpkgs", + "rev": "a85aaf82d9c29b41e37bc0babd3f69632dfdbaf1", + "type": "github" + }, + "original": { + "owner": "tadfisher", + "repo": "android-nixpkgs", + "type": "github" + } + }, + "devshell": { + "inputs": { + "nixpkgs": [ + "android-nixpkgs", + "nixpkgs" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1695195896, + "narHash": "sha256-pq9q7YsGXnQzJFkR5284TmxrLNFc0wo4NQ/a5E93CQU=", + "owner": "numtide", + "repo": "devshell", + "rev": "05d40d17bf3459606316e3e9ec683b784ff28f16", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, "flake-utils": { "inputs": { - "systems": "systems" + "systems": "systems_2" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_3" }, "locked": { "lastModified": 1694529238, @@ -19,6 +79,22 @@ } }, "nixpkgs": { + "locked": { + "lastModified": 1695145219, + "narHash": "sha256-Eoe9IHbvmo5wEDeJXKFOpKUwxYJIOxKUesounVccNYk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5ba549eafcf3e33405e5f66decd1a72356632b96", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1685566663, "narHash": "sha256-btHN1czJ6rzteeCuE/PNrdssqYD2nIA4w48miQAFloM=", @@ -36,8 +112,9 @@ }, "root": { "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "android-nixpkgs": "android-nixpkgs", + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_2" } }, "systems": { @@ -54,6 +131,36 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/ltx_flutter/flake.nix b/ltx_flutter/flake.nix index 13584b7..dd68b39 100644 --- a/ltx_flutter/flake.nix +++ b/ltx_flutter/flake.nix @@ -1,38 +1,76 @@ { -description = "Flutter 3.0.4"; -inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/23.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 = { - android_sdk.accept_license = true; - allowUnfree = true; - }; + description = "moxplatform"; + inputs = { + # nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + nixpkgs.url = "github:NixOS/nixpkgs/23.05"; + flake-utils.url = "github:numtide/flake-utils"; + android-nixpkgs.url = "github:tadfisher/android-nixpkgs"; + }; + + outputs = { self, nixpkgs, flake-utils, android-nixpkgs }: flake-utils.lib.eachDefaultSystem (system: let + pkgs = import nixpkgs { + inherit system; + config = { + android_sdk.accept_license = true; + allowUnfree = true; }; - buildToolsVersion = "30.0.3"; - androidComposition = pkgs.androidenv.composeAndroidPackages { - buildToolsVersions = [ buildToolsVersion "28.0.3" ]; - platformVersions = [ "31" "28" ]; - abiVersions = [ "armeabi-v7a" "arm64-v8a" ]; - }; - androidSdk = androidComposition.androidsdk; - in - { - devShell = - with pkgs; mkShell rec { - ANDROID_SDK_ROOT = "${androidSdk}/libexec/android-sdk"; - buildInputs = [ - chromium - flutter - androidSdk - jdk11 - android-studio - ]; - }; - }); + }; + # Everything to make Flutter happy + sdk = android-nixpkgs.sdk.${system} (sdkPkgs: with sdkPkgs; [ + cmdline-tools-latest + build-tools-30-0-3 + build-tools-33-0-2 + build-tools-34-0-0 + platform-tools + emulator + patcher-v4 + platforms-android-30 + platforms-android-31 + platforms-android-33 + ]); + pinnedJDK = pkgs.jdk17; + in { + devShell = pkgs.mkShell { + buildInputs = with pkgs; [ + # Android + pinnedJDK + sdk + + # Flutter + flutter dart + + # Code hygiene + gitlint + + # Flutter dependencies for linux desktop + atk + cairo + clang + cmake + epoxy + gdk-pixbuf + glib + gtk3 + harfbuzz + ninja + pango + pcre + pkg-config + xorg.libX11 + xorg.xorgproto + ]; + + # Make Flutter build on desktop + CPATH = "${pkgs.xorg.libX11.dev}/include:${pkgs.xorg.xorgproto}/include"; + LD_LIBRARY_PATH = with pkgs; lib.makeLibraryPath [ atk cairo epoxy gdk-pixbuf glib gtk3 harfbuzz pango ]; + + ANDROID_HOME = "${sdk}/share/android-sdk"; + ANDROID_SDK_ROOT = "${sdk}/share/android-sdk"; + JAVA_HOME = pinnedJDK; + + # Fix an issue with Flutter using an older version of aapt2, which does not know + # an used parameter. + GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${sdk}/share/android-sdk/build-tools/34.0.0/aapt2"; + }; + }); } diff --git a/ltx_flutter/pubspec.yaml b/ltx_flutter/pubspec.yaml index c784055..5dfd8d5 100644 --- a/ltx_flutter/pubspec.yaml +++ b/ltx_flutter/pubspec.yaml @@ -3,7 +3,7 @@ description: A new Flutter project. publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 0.0.1+1 +version: 0.1.0+1 environment: sdk: '>=2.19.4 <4.0.0'