Initial commit
This commit is contained in:
commit
b48afe877e
9
README.md
Normal file
9
README.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# flutter-flake
|
||||||
|
|
||||||
|
This is a flake that configures Flutter for you.
|
||||||
|
|
||||||
|
It was created because I hated configuring Android for Flutter. It’s currently mostly made to do that.
|
||||||
|
|
||||||
|
Feel free to open a PR if you want to add MacOS support or something.
|
||||||
|
|
||||||
|
This isn’t well tested. If you’re a flutter developer, please report any (potentially glaringly obvious) problems.
|
17
android/flake.nix
Normal file
17
android/flake.nix
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
flutter-flake.url = "github:schuelermine/flutter-flake/b0";
|
||||||
|
flake-utils.url = "github:numtide/flake-utils/master";
|
||||||
|
};
|
||||||
|
outputs = { self, nixpkgs, flutter-flake, flake-utils }:
|
||||||
|
flake-utils.lib.eachDefaultSystem (system: {
|
||||||
|
devShells.default = flutter-flake.lib.get-devShell {
|
||||||
|
inherit nixpkgs system;
|
||||||
|
enable-android = true;
|
||||||
|
nixpkgsConfig = {
|
||||||
|
allowUnfree = true;
|
||||||
|
android_sdk.accept_license = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
58
flake.nix
Normal file
58
flake.nix
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
{
|
||||||
|
outputs = { self }: {
|
||||||
|
templates.android = {
|
||||||
|
path = ./android;
|
||||||
|
description =
|
||||||
|
"A flake for getting a dev shell with Android SDK & Flutter using flutter-flake";
|
||||||
|
};
|
||||||
|
lib = let
|
||||||
|
optional = q: x: optList q [ x ];
|
||||||
|
optList = q: xs: if q then xs else [ ];
|
||||||
|
optStr = q: str:
|
||||||
|
if q then ''
|
||||||
|
${str}
|
||||||
|
'' else
|
||||||
|
"";
|
||||||
|
guard = q: k: if q then k else null;
|
||||||
|
|
||||||
|
in {
|
||||||
|
get-devShell = { nixpkgs, pkgs ? import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
config = nixpkgsConfig;
|
||||||
|
}, system, nixpkgsConfig ? { }, enable-android ? false
|
||||||
|
, enable-linuxDesktop ? false, enable-web ? true
|
||||||
|
, enable-windowsDesktop ? false, enable-macDesktop ? false
|
||||||
|
, enable-ios ? false
|
||||||
|
, chromeExecutable ? pkgs.ungoogled-chromium + "/bin/chromium" }:
|
||||||
|
|
||||||
|
let
|
||||||
|
androidComposition = pkgs.androidenv.composeAndroidPackages {
|
||||||
|
platformToolsVersion = "31.0.3";
|
||||||
|
toolsVersion = "26.1.1";
|
||||||
|
};
|
||||||
|
|
||||||
|
flutter-deps = optional enable-android androidComposition.androidsdk
|
||||||
|
++ optList enable-linuxDesktop
|
||||||
|
(with pkgs; [ clang cmake ninja pkg-config gtk3 ]);
|
||||||
|
|
||||||
|
flutter-fhs = pkgs.buildFHSUserEnv {
|
||||||
|
name = "flutter";
|
||||||
|
targetPkgs = (_: flutter-deps);
|
||||||
|
runScript = pkgs.flutter + "/bin/flutter";
|
||||||
|
};
|
||||||
|
|
||||||
|
in if enable-ios || enable-macDesktop || enable-windowsDesktop then
|
||||||
|
builtins.throw ''
|
||||||
|
iOS, macOS and Windows are not supported currently. Feel free to contribute.
|
||||||
|
''
|
||||||
|
else
|
||||||
|
pkgs.mkShell {
|
||||||
|
packages = with pkgs; [ flutter-fhs ] ++ flutter-deps;
|
||||||
|
${guard enable-web "CHROME_EXECUTABLE"} = chromeExecutable;
|
||||||
|
shellHook = optStr enable-android ''
|
||||||
|
flutter config --android-sdk ${androidComposition.androidsdk}/libexec/android-sdk
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user