-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add IDX template configuration to Gemini samples (#2344)
Adds the configuration needed to open a subdirectory as a template in IDX. Configuration is added to two samples that use Gemini -- Dynamic theme and Gemini tasks
- Loading branch information
1 parent
af7b073
commit 0e32897
Showing
6 changed files
with
172 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# To learn more about how to use Nix to configure your environment | ||
# see: https://developers.google.com/idx/guides/customize-idx-env | ||
{ pkgs, ... }: { | ||
# Which nixpkgs channel to use. | ||
channel = "stable-23.11"; # or "unstable" | ||
# Use https://search.nixos.org/packages to find packages | ||
packages = [ | ||
pkgs.nodePackages.firebase-tools | ||
pkgs.jdk17 | ||
pkgs.unzip | ||
]; | ||
# Sets environment variables in the workspace | ||
env = {}; | ||
idx = { | ||
# Search for the extensions you want on https://open-vsx.org/ and use "publisher.id" | ||
extensions = [ | ||
"Dart-Code.flutter" | ||
"Dart-Code.dart-code" | ||
]; | ||
workspace = { | ||
# Runs when a workspace is first created with this `dev.nix` file | ||
onCreate = { | ||
build-flutter = '' | ||
cd /home/user/myapp/android | ||
./gradlew \ | ||
--parallel \ | ||
-Pverbose=true \ | ||
-Ptarget-platform=android-x86 \ | ||
-Ptarget=/home/user/myapp/lib/main.dart \ | ||
-Pbase-application-name=android.app.Application \ | ||
-Pdart-defines=RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC85NzU1MDkwN2I3MGY0ZjNiMzI4YjZjMTYwMGRmMjFmYWMxYTE4ODlhLw== \ | ||
-Pdart-obfuscation=false \ | ||
-Ptrack-widget-creation=true \ | ||
-Ptree-shake-icons=false \ | ||
-Pfilesystem-scheme=org-dartlang-root \ | ||
assembleDebug | ||
# TODO: Execute web build in debug mode. | ||
# flutter run does this transparently either way | ||
# https://github.com/flutter/flutter/issues/96283#issuecomment-1144750411 | ||
# flutter build web --profile --dart-define=Dart2jsOptimization=O0 | ||
adb -s localhost:5555 wait-for-device | ||
''; | ||
}; | ||
|
||
# To run something each time the workspace is (re)started, use the `onStart` hook | ||
}; | ||
# Enable previews and customize configuration | ||
previews = { | ||
enable = true; | ||
previews = { | ||
web = { | ||
command = ["flutter" "run" "--machine" "-d" "web-server" "--web-hostname" "0.0.0.0" "--web-port" "$PORT"]; | ||
manager = "flutter"; | ||
}; | ||
android = { | ||
command = ["flutter" "run" "--machine" "-d" "android" "-d" "localhost:5555"]; | ||
manager = "flutter"; | ||
}; | ||
}; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "Flutter dynamic theme", | ||
"description": "A template for a Flutter app that uses Gemini to dynamically create a theme.", | ||
"icon": "https://www.gstatic.com/images/branding/productlogos/idx/v1/192px.svg", | ||
"params": [], | ||
"host": { | ||
"virtualization": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# No user-configurable parameters | ||
{ pkgs, ... }: { | ||
packages = [ | ||
pkgs.flutter | ||
]; | ||
# Shell script that produces the final environment | ||
bootstrap = '' | ||
export HOME=/home/user | ||
export PATH="$PATH":"$HOME/flutter/bin" | ||
cp -rf ${./.} "$out" | ||
chmod -R +w "$out" | ||
rm -rf "$out/.git" "$out/idx-template".{nix,json} | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# To learn more about how to use Nix to configure your environment | ||
# see: https://developers.google.com/idx/guides/customize-idx-env | ||
{ pkgs, ... }: { | ||
# Which nixpkgs channel to use. | ||
channel = "stable-23.11"; # or "unstable" | ||
# Use https://search.nixos.org/packages to find packages | ||
packages = [ | ||
pkgs.nodePackages.firebase-tools | ||
pkgs.jdk17 | ||
pkgs.unzip | ||
]; | ||
# Sets environment variables in the workspace | ||
env = {}; | ||
idx = { | ||
# Search for the extensions you want on https://open-vsx.org/ and use "publisher.id" | ||
extensions = [ | ||
"Dart-Code.flutter" | ||
"Dart-Code.dart-code" | ||
]; | ||
workspace = { | ||
# Runs when a workspace is first created with this `dev.nix` file | ||
onCreate = { | ||
build-flutter = '' | ||
cd /home/user/myapp/android | ||
./gradlew \ | ||
--parallel \ | ||
-Pverbose=true \ | ||
-Ptarget-platform=android-x86 \ | ||
-Ptarget=/home/user/myapp/lib/main.dart \ | ||
-Pbase-application-name=android.app.Application \ | ||
-Pdart-defines=RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC85NzU1MDkwN2I3MGY0ZjNiMzI4YjZjMTYwMGRmMjFmYWMxYTE4ODlhLw== \ | ||
-Pdart-obfuscation=false \ | ||
-Ptrack-widget-creation=true \ | ||
-Ptree-shake-icons=false \ | ||
-Pfilesystem-scheme=org-dartlang-root \ | ||
assembleDebug | ||
# TODO: Execute web build in debug mode. | ||
# flutter run does this transparently either way | ||
# https://github.com/flutter/flutter/issues/96283#issuecomment-1144750411 | ||
# flutter build web --profile --dart-define=Dart2jsOptimization=O0 | ||
adb -s localhost:5555 wait-for-device | ||
''; | ||
}; | ||
|
||
# To run something each time the workspace is (re)started, use the `onStart` hook | ||
}; | ||
# Enable previews and customize configuration | ||
previews = { | ||
enable = true; | ||
previews = { | ||
web = { | ||
command = ["flutter" "run" "--machine" "-d" "web-server" "--web-hostname" "0.0.0.0" "--web-port" "$PORT"]; | ||
manager = "flutter"; | ||
}; | ||
android = { | ||
command = ["flutter" "run" "--machine" "-d" "android" "-d" "localhost:5555"]; | ||
manager = "flutter"; | ||
}; | ||
}; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "Todo list with Flutter and Gemini", | ||
"description": "A template for a todo list app that integrates with the Gemini API", | ||
"icon": "https://www.gstatic.com/images/branding/productlogos/idx/v1/192px.svg", | ||
"params": [], | ||
"host": { | ||
"virtualization": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# No user-configurable parameters | ||
{ pkgs, ... }: { | ||
packages = [ | ||
pkgs.flutter | ||
]; | ||
# Shell script that produces the final environment | ||
bootstrap = '' | ||
export HOME=/home/user | ||
export PATH="$PATH":"$HOME/flutter/bin" | ||
cp -rf ${./.} "$out" | ||
chmod -R +w "$out" | ||
rm -rf "$out/.git" "$out/idx-template".{nix,json} | ||
''; | ||
} |