A very simple flutter environment using packages provided by nix package manager.
- Nix Package Manager
- direnv
- direnv homepage
clone repo, update variables in optionsFlutterCreate.nix and push to your own git repo
- clone repository
git clone https://github.com/gesker/flutter-env-nix
- delete .git folder
rm -rf flutter-env-nix/.git
- cd into folder
cd flutter-env-nix
- Update variables in optionsFlutterCreate.nix
- values in optionsFlutterCreate.nix are used in execution of
flutter create
command - Note: The default folder specified for the flutter project
myproject
is already in .gitignore - The value of
flutterProjectFolder
in optionsFlutterCreate.nix can be an actual new sub-folder where your flutter project will be created OR it can be.
- If set to
.
I would recommend renaming the folderflutter-env-nix
to the name of your project
- If set to
- values in optionsFlutterCreate.nix are used in execution of
- Take a good look at the following 2 files
- flake.nix
- Composes Android environment in similar fashion as described at wiki.nixos.org
- Downloads and installed required software packaged from the NixOS repository
- Unstable Branch has the most recent versions published by NixOS project
- Sets MOST environment variables
- ANDROID_NDK_ROOT
- ANDROID_SDK_ROOT
- CHROME_EXECUTABLE
- CMAKE_ROOT
- DART_ROOT
- FLUTTER_ROOT
- GRADLE_HOME
- Default is
.gradle
in THIS directory
- Default is
- GRADLE_OPTS
- JAVA_HOME
- LANG
- LC_ALL
- PUB_CACHE
- Default is
.pub-cache
in THIS directory
- Default is
- .envrc
- These commands will be run by the direnv utility
- Mostly output of ALL environment variables set in this project and the output of the
flutter doctor
command - Sets REMAINING environment variables
- ANDROID_USER_HOME
- ANDROID_AVD_HOME
- PATH
- Ensures that
cmake
provided by the Android project is first in PATH - Ensures that the
.pub-cache
subdirectory is last in PATH
- Ensures that
- run
direnv allow
- run
git init
,git remote add origin ...
,git push
, etc.
- flake.nix
- decide if Android/Sdk needs to be linked to $HOME/Android/Sdk
- So far this does not seem to be necessary
- build Android and Android Studio based on values in flake.nix
- Copy routines from NixOS repo ??
- Currently just using the most recent versions Android tools provided by NixOS
- fastlane template and github actions ??
- verify emulator on MacOS
- Android Studio is NOT installed on MacOS
- Project can still be accessed from outside the project
- Consider adding plugins to Android Studio that work with direnv