From 7dbda0f88ead8ffaea75fa6d35c438ad180e869b Mon Sep 17 00:00:00 2001 From: "brett.morgan" Date: Wed, 23 Oct 2024 23:01:27 +0000 Subject: [PATCH 1/6] Add IDX --- .idx/dev.nix | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .idx/dev.nix diff --git a/.idx/dev.nix b/.idx/dev.nix new file mode 100644 index 0000000000..435a5d8de6 --- /dev/null +++ b/.idx/dev.nix @@ -0,0 +1,51 @@ +# 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.flutter + ]; + + # 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.dart-code" + "Dart-Code.flutter" + ]; + + # Enable previews + previews = { + enable = true; + previews = { + # web = { + # # Example: run "npm run dev" with PORT set to IDX's defined port for previews, + # # and show it in IDX's web preview panel + # command = ["npm" "run" "dev"]; + # manager = "web"; + # env = { + # # Environment variables to set for your server + # PORT = "$PORT"; + # }; + # }; + }; + }; + + # Workspace lifecycle hooks + workspace = { + # Runs when a workspace is first created + onCreate = { + updateStable = "flutter channel stable && flutter upgrade && flutter pub get"; + }; + # Runs when the workspace is (re)started + onStart = { + # Example: start a background task to watch and re-build backend code + # watch-backend = "npm run watch-backend"; + }; + }; + }; +} From df8cee8c32d78c69158a1b327703be4d6a9981dc Mon Sep 17 00:00:00 2001 From: "brett.morgan" Date: Fri, 25 Oct 2024 01:52:27 +0000 Subject: [PATCH 2/6] Tidyup --- .idx/dev.nix | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/.idx/dev.nix b/.idx/dev.nix index 435a5d8de6..8e245fbe25 100644 --- a/.idx/dev.nix +++ b/.idx/dev.nix @@ -6,9 +6,11 @@ # Use https://search.nixos.org/packages to find packages packages = [ + pkgs.jdk17 + pkgs.unzip pkgs.flutter ]; - + # Sets environment variables in the workspace env = {}; idx = { @@ -17,25 +19,6 @@ "Dart-Code.dart-code" "Dart-Code.flutter" ]; - - # Enable previews - previews = { - enable = true; - previews = { - # web = { - # # Example: run "npm run dev" with PORT set to IDX's defined port for previews, - # # and show it in IDX's web preview panel - # command = ["npm" "run" "dev"]; - # manager = "web"; - # env = { - # # Environment variables to set for your server - # PORT = "$PORT"; - # }; - # }; - }; - }; - - # Workspace lifecycle hooks workspace = { # Runs when a workspace is first created onCreate = { @@ -43,8 +26,7 @@ }; # Runs when the workspace is (re)started onStart = { - # Example: start a background task to watch and re-build backend code - # watch-backend = "npm run watch-backend"; + updateStable = "flutter channel stable && flutter upgrade && flutter pub get"; }; }; }; From e79bbc5ba6b1f658d6dcd1f97c82f85b39abf548 Mon Sep 17 00:00:00 2001 From: Brett Morgan Date: Fri, 6 Dec 2024 12:16:03 +1100 Subject: [PATCH 3/6] Update dev.nix --- .idx/dev.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.idx/dev.nix b/.idx/dev.nix index 8e245fbe25..914b1e713e 100644 --- a/.idx/dev.nix +++ b/.idx/dev.nix @@ -2,7 +2,7 @@ # see: https://developers.google.com/idx/guides/customize-idx-env { pkgs, ... }: { # Which nixpkgs channel to use. - channel = "stable-23.11"; # or "unstable" + channel = "stable-24.05"; # or "unstable" # Use https://search.nixos.org/packages to find packages packages = [ From 93049457429e60578549c0eec128c020f243c0a5 Mon Sep 17 00:00:00 2001 From: Brett Morgan Date: Fri, 6 Dec 2024 12:16:56 +1100 Subject: [PATCH 4/6] Drop `flutter` as redundant --- .idx/dev.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/.idx/dev.nix b/.idx/dev.nix index 914b1e713e..dc5d515740 100644 --- a/.idx/dev.nix +++ b/.idx/dev.nix @@ -8,7 +8,6 @@ packages = [ pkgs.jdk17 pkgs.unzip - pkgs.flutter ]; # Sets environment variables in the workspace From 96ac0a06d48b9f224a1b22352772e24203070903 Mon Sep 17 00:00:00 2001 From: Brett Morgan Date: Fri, 6 Dec 2024 12:18:14 +1100 Subject: [PATCH 5/6] Drop `onStart` --- .idx/dev.nix | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.idx/dev.nix b/.idx/dev.nix index dc5d515740..8b4e6f92d8 100644 --- a/.idx/dev.nix +++ b/.idx/dev.nix @@ -23,10 +23,6 @@ onCreate = { updateStable = "flutter channel stable && flutter upgrade && flutter pub get"; }; - # Runs when the workspace is (re)started - onStart = { - updateStable = "flutter channel stable && flutter upgrade && flutter pub get"; - }; }; }; } From 7f27860976cfa653254dda0f0bcb8de53808d7ac Mon Sep 17 00:00:00 2001 From: Brett Morgan Date: Fri, 6 Dec 2024 15:12:28 +1100 Subject: [PATCH 6/6] Run `flutter pub get` in project directories --- .idx/dev.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.idx/dev.nix b/.idx/dev.nix index 8b4e6f92d8..bf44316d92 100644 --- a/.idx/dev.nix +++ b/.idx/dev.nix @@ -21,7 +21,7 @@ workspace = { # Runs when a workspace is first created onCreate = { - updateStable = "flutter channel stable && flutter upgrade && flutter pub get"; + updateStable = "flutter channel stable && flutter upgrade && for dir in `find . -name pubspec.yaml -exec dirname {} \; | sort`; do pushd $dir ; flutter pub get; popd; done"; }; }; };