Skip to content

Commit

Permalink
Add Nix flake
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasWanke committed May 16, 2024
1 parent 478aa4d commit 883ae26
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 13 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.direnv/

### Dart ###

# Files and directories created by pub
Expand Down
18 changes: 5 additions & 13 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -336,18 +336,18 @@ packages:
dependency: transitive
description:
name: material_color_utilities
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
url: "https://pub.dev"
source: hosted
version: "0.5.0"
version: "0.8.0"
meta:
dependency: transitive
description:
name: meta
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
url: "https://pub.dev"
source: hosted
version: "1.10.0"
version: "1.12.0"
num_utilities:
dependency: transitive
description:
Expand Down Expand Up @@ -554,14 +554,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.1.0"
web:
dependency: transitive
description:
name: web
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
url: "https://pub.dev"
source: hosted
version: "0.3.0"
web_socket_channel:
dependency: transitive
description:
Expand All @@ -587,5 +579,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.2.0 <4.0.0"
dart: ">=3.3.0-0 <4.0.0"
flutter: ">=3.16.0"
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
inputs = {
nixpkgs.url =
"github:nixos/nixpkgs?ref=a22a985f13d58b2bafb4964dd2bdf6376106a2d2";
# https://github.com/NixOS/nixpkgs/pull/311815
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;
};
};

# Android
androidSdkArgs = {
buildToolsVersions = [ "30.0.3" ];
platformVersions = [ "34" ];
};
androidComposition =
pkgs.androidenv.composeAndroidPackages androidSdkArgs;
androidSdk = androidComposition.androidsdk;
androidEmulator = pkgs.androidenv.emulateApp {
name = "Emulator";
platformVersion = "34";
systemImageType = "google_apis_playstore";
abiVersion = "x86_64";
configOptions = {
# https://android.googlesource.com/platform/external/qemu/+/refs/heads/master/android/avd/hardware-properties.ini
"hw.ramSize" = "4096";
"hw.lcd.width" = "1170";
"hw.lcd.height" = "2532";
"hw.lcd.density" = "460";
"hw.keyboard" = "yes";
};
sdkExtraArgs = androidSdkArgs;
};
in {
devShell = with pkgs;
mkShell {
ANDROID_SDK_ROOT = "${androidSdk}/libexec/android-sdk";
FLUTTER_ROOT = flutterPackages.v3_19;
buildInputs = [ androidEmulator androidSdk flutterPackages.v3_19 ];
};
});
}

0 comments on commit 883ae26

Please sign in to comment.