Skip to content

Commit

Permalink
Add Nix flake
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasWanke committed Jul 24, 2024
1 parent 35d027b commit e15c141
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 2 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
local/
.direnv/

pubspec.lock
Gemfile.lock

# Miscellaneous
*.class
Expand Down
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.

53 changes: 53 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
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;
};
};

flutter = pkgs.flutterPackages.v3_22;

# 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 = flutter;
buildInputs = [ androidEmulator androidSdk flutter ];
};
});
}

0 comments on commit e15c141

Please sign in to comment.