From f17f0b92eb02fd9c90c6ff23ab5590a758f6b751 Mon Sep 17 00:00:00 2001 From: Oystein Kristoffer Tveit Date: Wed, 13 Nov 2024 18:26:27 +0100 Subject: [PATCH] Initial commit --- .envrc | 1 + LICENSE | 9 +++++++++ README.md | 3 +++ flake.lock | 26 ++++++++++++++++++++++++++ flake.nix | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 85 insertions(+) create mode 100644 .envrc create mode 100644 LICENSE create mode 100644 README.md create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7dfbfd1 --- /dev/null +++ b/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2024 oysteikt + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..246a569 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# nix-flutter-android-template + +I always forgor how to make these 💀 not anymore \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..1bf6ffb --- /dev/null +++ b/flake.lock @@ -0,0 +1,26 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1731239293, + "narHash": "sha256-q2yjIWFFcTzp5REWQUOU9L6kHdCDmFDpqeix86SOvDc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9256f7c71a195ebe7a218043d9f93390d49e6884", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-24.05", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ee08604 --- /dev/null +++ b/flake.nix @@ -0,0 +1,46 @@ +{ + inputs.nixpkgs.url = "nixpkgs/nixos-24.05"; + outputs = { self, nixpkgs }: let + inherit (nixpkgs) lib; + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + "armv7l-linux" + ]; + + forAllSystems = f: lib.genAttrs systems (system: let + pkgs = import nixpkgs { + inherit system; + config = { + android_sdk.accept_license = true; + allowUnfree = true; + }; + }; + androidSdk = (pkgs.androidenv.composeAndroidPackages { + buildToolsVersions = [ "34.0.0" "30.0.3" ]; + platformVersions = [ "34" ]; + abiVersions = [ "armeabi-v7a" "arm64-v8a" ]; + includeEmulator = true; + cmdLineToolsVersion = "13.0"; + }).androidsdk; + in f system pkgs androidSdk); + in { + devShells = forAllSystems (_: pkgs: androidSdk: { + default = let + jdk = pkgs.jdk17; + in pkgs.mkShell { + env = { + ANDROID_SDK_ROOT = "${androidSdk}/libexec/android-sdk"; + JAVA_HOME = "${jdk}/lib/openjdk"; + }; + packages = [ + pkgs.flutter + androidSdk + jdk + ]; + }; + }); + }; +}